feat(menu): enhance Menu and TenantMenu models with parent-child relationships and static content support

This commit is contained in:
2026-07-23 15:54:16 -03:00
parent 018f3f6c13
commit aed818da6e
5 changed files with 170 additions and 9 deletions

View File

@@ -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');
}
}