配置功能完善
This commit is contained in:
45
app/Models/HomeModule.php
Normal file
45
app/Models/HomeModule.php
Normal 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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user