image uploader to fill problem
Hi,
i'm trying to fill image uploader from model. This is model return;
attributes: array:11 [▼
"id" => 1
"model_type" => "App\Models\Modules\StaticPages"
"model_id" => 1
"description" => "test seo açıklama"
"title" => "test seo başlıkbb"
"image" => "{"23f1baac-917a-4cc5-8901-104329634cc3":"seo_content\/seo_content-1698319573-1785-ekran-grnts-2023-09-27-162143.png"}"
"author" => null
"robots" => "noindex, nofollow"
"canonical_url" => null
"created_at" => "2023-10-26 14:06:48"
"updated_at" => "2023-10-26 14:26:13"
]
Fill code;
->afterStateHydrated(function (Group $component, ?Model $record) use ($only): void {
$component->getChildComponentContainer()->fill(
$record?->seo?->only($only) ?: []
);
})
->statePath('seo')
->dehydrated(false)
->saveRelationshipsUsing(function (Model $record, array $state) use ($only): void {
$state = collect($state)->only($only)->map(fn($value) => $value ?: null)->all();
if ($record->seo && $record->seo->exists) {
$record->seo->update($state);
} else {
$record->seo()->create($state);
}
});
image uploader not see file, any advice?1 Reply
(Bump) any advice