fix(work-order-dashboard): guard getFirstMediaUrl call on Vehicle
Vehicle model doesn't use Spatie MediaLibrary — the direct call broke the dashboard for any WO whose vehicle has no MediaLibrary integration. Guard with method_exists and remove the diagnostic logging + URL echo now that the routing issue is resolved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,16 +46,6 @@ class WorkOrderDashboard extends Page
|
||||
$id = (int) $wo;
|
||||
$this->recordId = $id;
|
||||
|
||||
\Log::warning('WorkOrderDashboard.mount', [
|
||||
'wo_raw' => $wo,
|
||||
'wo_int' => $id,
|
||||
'url' => request()->fullUrl(),
|
||||
'referer' => request()->headers->get('referer'),
|
||||
'method' => request()->method(),
|
||||
'auth_id' => auth()->id(),
|
||||
'tenant' => app(\App\Tenancy\TenantManager::class)->current()?->slug,
|
||||
]);
|
||||
|
||||
$found = WorkOrder::with([
|
||||
'client', 'vehicle', 'master',
|
||||
'works.labor', 'works.master',
|
||||
@@ -71,7 +61,7 @@ class WorkOrderDashboard extends Page
|
||||
$tenantSlug = $tenant?->slug ?? '—';
|
||||
$msg = $existsGlobally
|
||||
? sprintf(__('Fișa #%d există, dar nu aparține tenantului „%s".'), $id, $tenantSlug)
|
||||
: sprintf(__('Fișa #%d nu există. URL apelat: %s'), $id, request()->fullUrl());
|
||||
: sprintf(__('Fișa #%d nu există.'), $id);
|
||||
\Filament\Notifications\Notification::make()
|
||||
->title(__('Fișă indisponibilă'))
|
||||
->body($msg)
|
||||
|
||||
Reference in New Issue
Block a user