| Current Path : /var/www/html/dynaweb-starter/plugin/dynaweb-site/src/Models/ |
| Current File : /var/www/html/dynaweb-starter/plugin/dynaweb-site/src/Models/FrontendSite.php |
<?php
namespace Dynaweb\DynawebSite\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Builder;
use IbrahimBougaoua\FilamentSortOrder\Traits\SortOrder;
use OwenIt\Auditing\Contracts\Auditable;
class FrontendSite extends Model implements Auditable
{
use HasFactory;
use SortOrder;
use \OwenIt\Auditing\Auditable;
/**
* Get the phone associated with the user.
*/
public function header(): BelongsTo
{
return $this->belongsTo(FrontendComponent::class, 'header_fk');
}
/**
* Get the phone associated with the user.
*/
public function footer(): BelongsTo
{
return $this->belongsTo(FrontendComponent::class, 'footer_fk');
}
/**
* Get the phone associated with the user.
*/
public function page(): HasOne
{
return $this->HasOne(FrontendPage::class, 'frontend_page', 'site_fk');
}
/**
* Scope a query to only include active site.
*/
public function scopeActive(Builder $query): void
{
$query->where('status', 1);
}
}