Zlatiborac
Zlatiborac
FFilament
Created by Zlatiborac on 10/29/2024 in #❓┊help
Display date format
I am trying to format datePicker field using
DatePicker::make('date_of_birth')
->displayFormat('d.m.Y.')
->required(),
DatePicker::make('date_of_birth')
->displayFormat('d.m.Y.')
->required(),
but I am still getting the mm/dd/YYYY format in the form field. I tried changing or adding some settings in config/filament.php file but still no successs. Only way I was able to resolve this was by using ->native(false)
DatePicker::make('date_of_birth')
->displayFormat('d.m.Y.')
->native(false)
->required(),
DatePicker::make('date_of_birth')
->displayFormat('d.m.Y.')
->native(false)
->required(),
but then I am loosing the datepicker icon in the input field. Is there any way to resolve this? Is it some setting deeper down, like maybe php settings?
1 replies
FFilament
Created by Zlatiborac on 10/21/2024 in #❓┊help
Showing the last page as default
I would like when I go to my Posts page, and I get the table with results, to get the last page with the results, not the first, as it is default. Tried to find anything related in documentation, but no success.
4 replies
FFilament
Created by Zlatiborac on 10/15/2024 in #❓┊help
Making 2 version of uploaded image
What looked like a simple task become 2 day headache. I have a form, and one field for upload the image. When I hit submit I want to make two image from it. One would be resized (and this posed no problems) and second one which would be a thumb of the either uploaded image or resized. Tried to make it work doing some experiments, then I tried to google the solution, then Claude... One solution suggested using Intervention/Image, other Spatie media library, and all were so cumbersome, that I find it ridiculous. Any suggestions on how to resolve this, since documentation is so limited with examples of commands/arguments?
18 replies
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