feat(vehicle): dedicated photo upload with MediaLibrary + form field

Vehicle model now implements HasMedia + InteractsWithMedia and
registers a 'photos' collection. VehicleResource form gets a
SpatieMediaLibraryFileUpload section (collapsible, max 6 photos,
imageEditor enabled).

Dashboard already checks vehicle->getFirstMediaUrl('photos') first
and falls back to the WO's photos, so uploading here immediately
populates the vehicle card on the dashboard without any view changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-06 05:41:09 +00:00
parent 5a5f43f2de
commit e289fbc068
4 changed files with 21 additions and 2 deletions
@@ -93,6 +93,16 @@ class VehicleResource extends Resource
Forms\Components\TextInput::make('mileage')->label(__('Kilometraj'))->numeric()->default(0),
Forms\Components\TextInput::make('color')->maxLength(40),
]),
Schemas\Components\Section::make(__('Foto'))
->collapsible()->collapsed()->compact()
->schema([
Forms\Components\SpatieMediaLibraryFileUpload::make('photos')
->label(__('Fotografii'))
->collection('photos')
->multiple()->reorderable()->image()->imageEditor()->maxFiles(6)
->helperText(__('Prima poză apare pe dashboard-ul fișei ca imagine principală a mașinii.'))
->columnSpanFull(),
]),
Forms\Components\Textarea::make('notes')->label(__('Notițe'))->columnSpanFull()->rows(3),
]);
}