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:
@@ -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 }}">
|
||||
|
||||
Reference in New Issue
Block a user