Ayz
Guidance needed for upgrade to Laravel 11
I originally started a project with Laravel 10.10/FilamentPHP 3.1.36. Now I want to move to Laravel 11.
Are there other steps needed aside following the 11.x upgrade guide at laravel.com/docs? Can you point me to any write-up/ blog?
3 replies
how do you access properties on a resource from lifecycle hooks
I need an object filled once the create page opens so that the data is fetched once and can be referred to in each repeater field.
In the resource file I have this code:
public static Product $pr;
How can I refer to this variable in the Create file's afterFill hook for instance?5 replies
how can you access a select field's currently selected option from itemLabel function of a Repeater?
So I want to add a label to a repeater item based on its content. Specifically from a certain Select field within it.
The $get function returns the value but I need the label.
Came across getOptionLabelUsing() but I dont know how to invoke it within a closure inside itemLabel().
What's the correct way to get at the label?
2 replies
can a dependent select be made to default to first item (i.e. not show 'select an option')? a bug?
I have tried
->searchPrompt(null)
on a select field that depends on another trigger field. It works half-heartedly though: on form load and picking on the trigger field, it still shows "select an option." It's only from a 2nd change of the trigger that it starts behaving as expected (which is to default to the first item).
Is there a way to do it? Should this be reported as a bug?5 replies
Clicking 'view' on resource with hasMany relations manager should not open in modal
I defined a relation mgr on a resource (master-detail structure)
Whilst create and edit icons on each record open up as a normal page, the view button opens as a modal.
Its kind of hard to zero in to this specific issue in the docs, how can I achieve it (i.e. no modal)?
6 replies
2 resource columns from same db column
I store a simple "qty" field in a db table to represent the number of units of a product. However, it needs to be presented in the resource list as "packs" and "units". On the fly, the system should populate the columns with a rounded down division and modulo operation respectively. So 12 units of a product of 10 per pack collation should show up as 1 pack, 2 units (2 separate columns)
Filament is however ignoring a 2nd TextColumn::make call to same database column.
How can I achieve this objective? Like if a column could be made out of a function defined in the model.
2 replies
how to place a custom nav item under a navgroup label
In my panel I have:
...
->navigationGroups([
'Main',
'Other'
])
->navigationItems([
NavigationItem::make('Sub')
->parentItem('Other')
])
The intention is for 'Sub' to appear under 'Other' but it doesn't appear.
When I replace 'parentItem' function with 'group', it blows up.
When I don't have either parentItem or group, the 'Sub' item is placed somewhere else entirely within the (other) resource navigationItems.
How do I get it right?4 replies
how to customize fi-sidebar-nav-groups
To reduce the spacing between the NavigationGroup's label and regular navigation items's label, I need "gap-y-7" changed to "gap-y-2" in "fi-sidebar-nav-groups".
So in resources/css/app.css, I have tried:
.fi-sidebar-nav-groups {
row-gap: 0.5rem !important;
}
Also tried using @apply gap-y-2 !important;
Neither makes a difference. What is the right way to do it?
4 replies
Resource Lifecycle hooks wrapped in a transaction
I would like to confirm, as implied by the title, that its all or nothing in terms of DB operations across the lifecycle hooks. For instance, in afterCreate hook of a resource, I intend to insert records in another table and update yet a 3rd. If I throw an exception at any stage, all preceding DB operations will also have no impact, including the resource. Is this a correct understanding of how filamentphp works? Or do I need to start the transaction explicitly?
4 replies