fix(work-order-dashboard): rename route param to {wo} to bypass model binding
Root cause of the "Fișa #0" bug: the page had public ?WorkOrder \$record = null; and the route slug was work-orders/{record}/dashboard. Livewire/Laravel saw the {record} param and the typed \$record property with the same name and attempted route model binding via BelongsToTenant scope. When that resolution didn't return a Model instance in a Livewire hydration context, mount() ended up being called with 0, so the button worked but the destination page redirected saying "Fișa #0". Fix: rename the route parameter to {wo} so it no longer collides with the property name, receive it as int|string in mount(), and do the find() ourselves. The property stays as \$record for the Blade view but is now always populated by our own code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,7 @@ class EditWorkOrder extends EditRecord
|
||||
->icon('heroicon-m-squares-2x2')
|
||||
->color('info')
|
||||
->url(fn () => \App\Filament\Tenant\Pages\WorkOrderDashboard::getUrl(
|
||||
parameters: ['record' => $this->record->id],
|
||||
parameters: ['wo' => $this->record->id],
|
||||
panel: 'tenant',
|
||||
)),
|
||||
Actions\Action::make('apply_template')
|
||||
|
||||
Reference in New Issue
Block a user