fix(work-order-dashboard): mount signature + null-safe record property
Made record property nullable (?WorkOrder) and mount() calls find() + explicit abort(404) instead of findOrFail() (which pass-through the model's tenant-scoped scope but doesn't clarify the 404 source). Added Feature test that boots the dashboard route via tenant subdomain (psauto.service.mir.md-style host), authenticates a user, and verifies the page returns non-404, non-500. Test passes both with and without route:cache, so the routing itself is fine — user-side 404 is most likely browser cache or CDN cache. 307/307 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ class WorkOrderDashboard extends Page
|
||||
|
||||
protected string $view = 'filament.tenant.pages.work-order-dashboard';
|
||||
|
||||
public WorkOrder $record;
|
||||
public ?WorkOrder $record = null;
|
||||
|
||||
public string $activeTab = 'works';
|
||||
|
||||
@@ -34,13 +34,18 @@ class WorkOrderDashboard extends Page
|
||||
|
||||
public function mount(int|string $record): void
|
||||
{
|
||||
$this->record = WorkOrder::with([
|
||||
$wo = WorkOrder::with([
|
||||
'client', 'vehicle', 'master',
|
||||
'works.labor', 'works.master',
|
||||
'parts.part', 'parts.batch',
|
||||
'parts.part',
|
||||
'payments.user',
|
||||
'subcontractJobs.subcontractor',
|
||||
])->findOrFail($record);
|
||||
])->find((int) $record);
|
||||
|
||||
if (! $wo) {
|
||||
abort(404);
|
||||
}
|
||||
$this->record = $wo;
|
||||
}
|
||||
|
||||
public function setTab(string $tab): void
|
||||
|
||||
Reference in New Issue
Block a user