components([ FileUpload::make('image_path') ->label('Bild') ->required() ->columnSpan('full') ->disk('public') ->directory('photos') ->image() ->helperText('Förklaring...'), TextInput::make('title') ->label('Rubrik') ->columnSpan('full') ->required() ->helperText('Förklaring...'), TextInput::make('uploaded_by') ->label('Uppladdat av') ->columnSpan('full') ->required() ->helperText('Förklaring...'), DatePicker::make('captured_at') ->label('Datum då foto togs') ->columnSpan('full') ->helperText('Förklaring...'), TextInput::make('desc') ->label('Kort beskrivning') ->columnSpan('full') ->helperText('Förklaring...'), Textarea::make('story') ->label('Berättelse') ->columnSpanFull() ->helperText('Förklaring...'), MapPicker::make('location') ->label('Plats') ->height(400) ->center(57.63072, 12.847787) ->zoom(15) ->autoCenter() ->tileLayersUrl(TileLayer::OpenStreetMap) ->columnSpanFull() ->latitudeFieldName('lat') ->longitudeFieldName('lng') ->helperText('Förklaring...'), Textarea::make('metadata') ->label('Metadata (EXIF)') ->columnSpanFull() ->rows(10) ->disabled() ->dehydrated(false) ->formatStateUsing(fn ($state) => $state ? json_encode($state, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) : null) ->visible(fn ($record) => $record && filled($record->metadata)), ]); } }