Restaurant Menu Management

Filament 4

Shows how to build nested resources using restaurant menus with categories and dishes. Both categories and dishes can be reordered directly in the Filament table.

FilamentExamples ThumbBase (9)

Get the Source Code:

How it works

In this project, we have two Models:

  • Category
    • name
    • position (for list ordering)
    • dishes (HasMany relationship)
  • Dish
    • name
    • price (stored as cents)
    • position (for list ordering)
    • category (BelongsTo relationship)

Models

Here are the contents of both models with fields and relationships defined.

app/Models/Category.php

use App\Observers\CategoryObserver;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
 
#[ObservedBy(CategoryObserver::class)]
class Category extends Model
{
use HasFactory;
 
protected $fillable = ['name', 'position'];
 
public function dishes(): HasMany
{
return $this->hasMany(Dish::class);
}
}

app/Models/Dish.php

use App\Observers\DishObserver;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
 
#[ObservedBy(DishObserver::class)]
class Dish extends Model
{
// ...

Next, we will:

  • Create resources
  • Create reordering actions
  • Create related records
  • Create Nested Resource
  • Manage Resources
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 113 Premium Examples for $99