Jon
How do i ignore saving of empty repeater relationship fields.
i finally found a solution that works:
Repeater::make('Alternative Names')
->label('Alternative names')
->relationship('hobbyAltNames')
->simple(
TextInput::make('name')
)
->mutateRelationshipDataBeforeCreateUsing(function (array $data
): ?array {
// Check if the name is empty
if (empty($data['name'])) {
return null; // Return null to prevent saving this item
}
return $data; // Return the modified data
})
Im thinking it would be worth it for the filament team to include a "ignoreEmptyRows" function to make this process easier.
12 replies
How do I only display data related to the model loaded into the panel?
I also want to break up the group resource form into individual pages instead of tabs.
But when i create a page, it asks if i want a create or edit page? When I probably need both.
So what is the best practice for this?
Do I create a seperate set of pages referencing the same model for each "tab" I want to display?
In this case I dont really need an index page, just the form fields. As the entire panel is really to manage settings for the group or user.
3 replies
are there any packages to allow users to manipulate an image when uploading?
I found this too... but it is also out of date.
I dont know enough to update it myself:
https://github.com/josefbehr/filament-spatie-media-library-croppie
5 replies
are there any packages to allow users to manipulate an image when uploading?
i found https://v2.filamentphp.com/plugins/image-cropper for vs2 of filament which appears to do what I need, but it appears to not be usable with the Spatie functionality?
IS there anything similar to extend spatie or the regular file upload?
5 replies
how do I add ->with statements to the table query?
I am making progress if i use this line:
the as __ part is not working.
I am not sure what needs to be adjusted within filament.
public static function table(Table $table): Table
{
return $table
->query(Hobby::with(self::getDemographics()))
->columns([...
when i made the function static, but now i get an error "Call to undefined relationship [users as m_count] on model [Modules\Hobbies\Models\Hobby]."
and ill assume all other demographic designations.the as __ part is not working.
I am not sure what needs to be adjusted within filament.
28 replies
How can I create a button to toggle a group of fields instead of utilizing the column filters
that worked. Thanks... is there a way to apply the ->visible to the entire group of fields to avoid repeating? as of now, ->visible isnt an available function for groups
6 replies