clrghouz/app/Models/Zone.php

43 lines
697 B
PHP
Raw Normal View History

2019-04-26 04:30:00 +00:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Traits\ScopeActive;
2019-04-26 04:30:00 +00:00
class Zone extends Model
{
use ScopeActive;
/* SCOPES */
public function scopeDomainZoneOrder($query)
{
return $query
->select('zones.*')
->join('domains',['domains.id'=>'zones.domain_id'])
->orderBy('domains.name')
->orderBy('zone_id');
}
2021-05-13 12:40:21 +00:00
/* RELATIONS */
public function addresses()
{
return $this->hasMany(Address::class)
->active()
->FTNorder()
->with(['system.sessions','system.setup','zone.domain']);
}
2021-05-13 12:40:21 +00:00
public function domain()
{
return $this->belongsTo(Domain::class);
}
public function system()
{
return $this->belongsTo(System::class);
}
2019-04-26 04:30:00 +00:00
}