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:
2026-08-05 19:28:54 +00:00
parent 5fff3d1a70
commit 114ae31b15
2 changed files with 72 additions and 4 deletions
@@ -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