Create a relationship manager for a pivot table

How do I create a relationship manager for a pivot table please?
Solution
On AmenityProperty define 2 ->belongsTo() relations (property and amenity). You should be able to access the data by property.name then. Maybe pivot.property.name or ->getStateUsing(fn ($record) => $record->pivot->property->name
Was this page helpful?