ldc-legaulois/app/Models/SectionApproach.php
2026-02-24 11:43:07 +01:00

42 lines
798 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class SectionApproach extends Model
{
public const MAX_SECTIONS = 6;
public const MIN_SECTIONS = 2;
protected $table = 'sections_approaches';
protected $fillable = [
'title',
'content',
'picture',
'picture_alt',
'picture_title',
'category_id',
'page_id'
];
protected $casts = [
'category_id' => 'int',
'page_id' => 'int'
];
public function category(): BelongsTo
{
return $this->belongsTo(CategoryApproaches::class, 'category_id');
}
public function page(): BelongsTo
{
return $this->belongsTo(StaticPage::class);
}
}