Zlatiborac
Zlatiborac
FFilament
Created by Zlatiborac on 5/18/2024 in #❓┊help
How can I dd() content of the relationship
I have fairly simple ProductResource
return $form
->schema([
Forms\Components\TextInput::make('name')
->required(),

Forms\Components\Fieldset::make('description')
->relationship('productDescription')
->schema([
TextInput::make('description')
->required(),
TextInput::make('price')
->required(),
])
]);
return $form
->schema([
Forms\Components\TextInput::make('name')
->required(),

Forms\Components\Fieldset::make('description')
->relationship('productDescription')
->schema([
TextInput::make('description')
->required(),
TextInput::make('price')
->required(),
])
]);
and I have this in CreateProduct added so I can see what is being passed from form
protected function mutateFormDataBeforeCreate(array $data): array
{
dd($data);
}
protected function mutateFormDataBeforeCreate(array $data): array
{
dd($data);
}
But the problem is that I can only see values of text inputs from first schema, but not second. It all saves to DB but I am curious how to see values from the second ->schema()
5 replies
FFilament
Created by Zlatiborac on 5/12/2024 in #❓┊help
Manipulation on uploaded image before save
As a a bit advanced step (for me) in learning Filament I wanted to build a system which will a new article for a imaginary news website. Made few tables (articles and article_images), added what was needed in form builder, added upload field and everything worked fine (with a bit of tweeking ofc). But the part I am stuck now is that image upload. I want the system to be able to 1) resize image to size(s) I need (validation I think I can get on my own) 2) rename the file to in my case, title of the article 3) use that filename as a filename in table article_images I tried some examples i found with ->beforeSave (completely not working for me), found in the manual that upload itself can do resizing (Cropping and resizing images) but I wanted to do some more complex things later. Any help, tutorial, article would be nice since I wasn't been able to find any, and this is my begining in Filament so have mercy 🙂
9 replies