52 lines
1.0 KiB
PHP
52 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Legal;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Spatie\Translatable\HasTranslations;
|
|
|
|
class LegalPage extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasTranslations;
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*/
|
|
protected $table = 'legal_pages';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<string>
|
|
*/
|
|
protected $fillable = [
|
|
'slug',
|
|
'title',
|
|
'content',
|
|
'is_active',
|
|
];
|
|
|
|
/**
|
|
* Translatable fields
|
|
*
|
|
* @var array<string>
|
|
*/
|
|
public $translatable = ['title', 'content'];
|
|
|
|
/**
|
|
* Retrieve the model for a bound value.
|
|
*
|
|
* @param mixed $value
|
|
* @param string|null $field
|
|
* @return Model|null
|
|
*/
|
|
public function resolveRouteBinding($value, $field = null)
|
|
{
|
|
return $this->where('slug', $value)
|
|
->where('is_active', true)
|
|
->firstOrFail();
|
|
}
|
|
}
|