Files
ploi-core/app/Models/Provider.php
Dennis 6ef5cd25f5 wip
2020-10-20 12:03:19 +02:00

42 lines
715 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Provider extends Model
{
protected $guarded = [];
public function getNameWithLabelAttribute()
{
$string = $this->name;
if ($this->label) {
$string .= ' (' . $this->label . ')';
}
return $string;
}
public function plans()
{
return $this->hasMany(ProviderPlan::class);
}
public function regions()
{
return $this->hasMany(ProviderRegion::class);
}
public function packages()
{
return $this->belongsToMany(Package::class);
}
public function servers()
{
return $this->hasMany(Server::class);
}
}