配置功能完善

This commit is contained in:
jiangdong.cheng
2026-02-12 15:37:49 +08:00
parent 67cd9501de
commit 56c685b579
14 changed files with 1259 additions and 701 deletions

45
app/Models/HomeModule.php Normal file
View File

@@ -0,0 +1,45 @@
<?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');
}
}