feat(menu): enhance Menu and TenantMenu models with parent-child relationships and static content support
This commit is contained in:
@@ -2,9 +2,36 @@
|
||||
|
||||
namespace App\Domains\Menu\Models;
|
||||
|
||||
use App\Domains\Tenant\Models\Tenant;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
class TenantMenu extends Pivot
|
||||
{
|
||||
protected $table = 'tenant_menues';
|
||||
protected $table = 'tenants_menues';
|
||||
|
||||
public $incrementing = true;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_code',
|
||||
'menu_code',
|
||||
'static_content',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'static_content' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
public function tenant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tenant::class, 'tenant_code', 'codigo');
|
||||
}
|
||||
|
||||
public function menu(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Menu::class, 'menu_code', 'code');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user