<?php
 namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; class Menu extends Model { use HasFactory; protected $fillable = [ 'brand_id', 'slug', 'name', 'is_active', ]; protected $casts = [ 'is_active' => 'boolean', ]; public function brand(): BelongsTo { return $this->belongsTo(Brand::class); } public function items(): HasMany { return $this->hasMany(MenuItem::class)->orderBy('sort_order'); } public function rootItems(): HasMany { return $this->items()->whereNull('parent_id'); } } 