How can I hydrate FileUpload field with a URL

I tried this code but it didn't work
Forms\Components\FileUpload::make('image')
->afterStateHydrated(
function (FileUpload $component, Closure $get) {
if ($get('image_id')) {
$image = Image::find($get('image_id'))->with('storageLocation')->first();
$component->state([$image->storageLocation->host_name . '/' . $image->file_path]);
}
}
),
Forms\Components\FileUpload::make('image')
->afterStateHydrated(
function (FileUpload $component, Closure $get) {
if ($get('image_id')) {
$image = Image::find($get('image_id'))->with('storageLocation')->first();
$component->state([$image->storageLocation->host_name . '/' . $image->file_path]);
}
}
),
The image dose show in the table
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server