Uploaded files/image does not show when in edit page

All other data succesfully fetched except the files in FIleUpload ComplainResource Wizard\Step::make('Fault') ->schema([ Select::make('title') ->label('Disciplinary Action') ->options([ 'merokok' => 'Merokok', 'berjudi' => 'Berjudi' ]) ->required(), TextInput::make('description') ->label('Details') ->maxLength(255) ->required(), DateTimePicker::make('incident_date'), FileUpload::make('file_path') ->disk('public') ->directory('complain') ->visibility('public') ->multiple() ->storeFileNamesIn('original_file_name') ->default(fn ($record) => $record?->complainFiles->pluck('file_path')->map(function ($path) { return asset('storage/complain/' . basename($path)); })->toArray()), ]), I've checked on the console but there is no error
7 Replies
LeandroFerreira
LeandroFerreira3mo ago
did you run php artisan storage:link did you config APP_URL in the .env file? console errors?
muhdnorfirdaus
muhdnorfirdaus3mo ago
Yes, i've run that storage link, But there is no error on console .env APP_URL=http://127.0.0.1:8000/ FILESYSTEM_DISK=public filesystem.php 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), 'throw' => false, ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', 'throw' => false, ], 's3' => [ 'driver' => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 'throw' => false, ], ],
muhdnorfirdaus
muhdnorfirdaus3mo ago
Weirdest part is it fetches all data except file path
No description
Lara Zeus
Lara Zeus3mo ago
->default() work only on create page, not edit, and on create the $record always null, so you really dont need default() but for the edit you can use ->state() or formatStateUsing
muhdnorfirdaus
muhdnorfirdaus3mo ago
Thanks, now i can see that it is fetching my file, but still it does not appear in edit
No description
muhdnorfirdaus
muhdnorfirdaus3mo ago
All data fetch except file
No description
No description
Lara Zeus
Lara Zeus3mo ago
try returning array without assets file uploads needs file names not urls
Want results from more Discord servers?
Add your server