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:
2026-08-05 20:34:30 +00:00
parent f82a3ebc57
commit 34f53383bf
2 changed files with 4 additions and 12 deletions
@@ -495,7 +495,9 @@
</div>
@if ($wo->vehicle)
@php
$photoUrl = $wo->vehicle->getFirstMediaUrl('photos') ?? null;
$photoUrl = method_exists($wo->vehicle, 'getFirstMediaUrl')
? ($wo->vehicle->getFirstMediaUrl('photos') ?: null)
: null;
@endphp
@if ($photoUrl)
<img class="wd-vehicle-photo" src="{{ $photoUrl }}" alt="{{ $wo->vehicle->make }}">