Level 122
code?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I need help with the below code, The Data is updating but the image is not stored in the storage folder
code?
use InteractsWithForms;
public ?array $data = [];
protected static ?string $navigationGroup = 'CMS';
protected static string $view = 'filament.pages.about-us';
public function mount(\App\Models\AboutUs $aboutUs): void
{
$aboutUsData = $aboutUs->where('id', 'a790911b-61f1-4178-8188-cebfd646c1d4')->first();
if ($aboutUsData) {
$this->form->fill($aboutUsData->toArray());
}
}
public function form(Form $form): Form
{
return $form
->schema([
Section::make()
->schema([
TextInput::make('title')
->required(),
RichEditor::make('description')
->required(),
FileUpload::make('image')
->helperText(new HtmlString('Image width: <span style="color: red">600px</span>, Height: <span style="color: red">500px</span> | <b>After upload image please click <span style="color: darkred;">pencil symbol</span> to edit size</b>'))
->image()
->disk('public')
->directory('upload')
->imageEditor()
->required(),
]),
Section::make()
->schema([
TextInput::make('youtube_link'),
TextInput::make('title_2'),
TextInput::make('description_2'),
])->columns(3),
])
->statePath('data');
}
public function update(\App\Models\AboutUs $aboutUs)
{
$update = $aboutUs->where('id', 'a790911b-61f1-4178-8188-cebfd646c1d4')->update($this->data);
if ($update) {
$notification = Notification::make()
->title('Saved successfully')
->success()
->send();
} else {
$notification = Notification::make()
->title('Not saved')
->danger()
->send();
}
return $notification;
}
protected function getFormActions(): array
{
return [
Action::make('update')
->label(__('Update'))
->submit('update'),
];
}
x-filament-panels::page <x-filament-panels::form wire:submit="update"> {{ $this->form }}
<x-filament-panels::form.actions :actions="$this->getFormActions()"/>
</x-filament-panels::form>
</x-filament-panels::page>
Please or to participate in this conversation.