46 lines
888 B
PHP
46 lines
888 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class HomeModule extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'module_key',
|
|
'name',
|
|
'title',
|
|
'subtitle',
|
|
'enabled',
|
|
'sort_order',
|
|
'limit',
|
|
'more_link_type',
|
|
'more_link_target',
|
|
'extra',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'enabled' => 'boolean',
|
|
'sort_order' => 'integer',
|
|
'limit' => 'integer',
|
|
'extra' => 'array',
|
|
];
|
|
}
|
|
|
|
public function items(): HasMany
|
|
{
|
|
return $this->hasMany(HomeModuleItem::class)
|
|
->orderBy('sort_order')
|
|
->orderBy('id');
|
|
}
|
|
}
|
|
|