cheesegrits
Getting Error in Sudden Change in Tab
For anyone stumbling across this, setting is $isLazy fixed an issue for me where I had multiple table widgets on a dashboard, using a filtersForm() on the dashboard and InteractsWithPageFilters on the widgets. Without setting $isLazy false for all table widgets, I was getting intermittent "table must not be accessed before initialization" when changing any of the filters. Setting $islazy to false for all table widgets fixed the problem.
9 replies
Pest Testing Repeater (extra value added in tests)
@ShawnVeltman (and anyone stumbling across this searching for the same issue). I just ran into this, and figured out I can use the ->set('repeater', null) approach (to remove any defaultItems) by using mountTableAction rather than callTableAction ...
By using mountTableAction() followed by setTableActionsData() and callMountedTableAction(), rather than the atomic callTableAction(), this enables me to slide that set('roles', null) in there before setting the data.
This lest me test repeaters with defaultItems, without changing my form schema.
9 replies
Extra sessions being created when clicking an action button
Well, other people are using both together ... we don't necessarily know that they aren't having the same issue, and just haven't noticed the extra sessions. Not a folder anyone ever looks in, typically.
17 replies
conditional table column
Right, but that's a global thing, you are either showing a column or not, depending on some condition. What OP wanted to do was, in the same column, show different column types depending on some condition. So on some rows show a Curator cell, on other rows show a TextColumn cell, within the same column.
10 replies
A non-numeric value encountered
Dunno if you are running the same code version, but in my version of Laravel, line 156 is reading the decay time, which I think it derives from your middleware incantation in the route.
So make sure you've specified that correctly, like ...
Or better yet, first just disable the throttle middleware entirely, see if the problem goes away. That would at least tell you where to start looking.
Also, please don't @ me. 🙂
11 replies
forceDeleteAction triggering deleted model event and not forceDeleted
Not at my computer, but iirc both delete and forceDelete events get triggered by Laravel when a model is force deleted, and in a deleting / deleted observer you have to check something like $model->isForceDeleting().
5 replies
repeater
Yes, you do need to generate the UUID. Here's an example from one of my apps. I'm not doing it on an action, I'm doing it on an afterStateUpdated() on a Select, where the thing they select dictates how many instances of a Repeater I need. The relevant fragment is ...
Note that I'm not prepending the UUID with record-. I'm pretty sure Filament only expects that prefix for existing data, where it's record-<key>. A new instance would just be a UUID.
And yes, I'm individually setting up each field in the repeat.
14 replies
Adding BelongsToMany that includes another BelongsToMany relation to a form
Your terminology is very inconsistent. You have referred to users, business areas, client areas, clinics and clients.
Can you describe what you are trying to achieve using consistent terminology, which matches your models.
And describe the UI you are trying to achieve. Like by "select the business areas" do you mean literally a multi select field?
16 replies
Update repeater
The takeaway here is that when you need to create a model for the pivot and work directly on it, rather than simply using a pivot as part of relationships and only working on the models either "side" of the pivot, then you need a singular primary key. This is a limitation of Laravel.
25 replies
Update repeater
Usually a pivot table doesn't need a singular primary key like 'id', it uses a composite key, like you did. Because usually you aren't directly working on the pivot table itself, you are working with the target table on the other "side" of the pivot, with BelongsToMany relationships.
But when you need to work on the actual pivot itself, where you create a model for the pivot, you do need a singular primary key. Laravel (and hence Filament) doesn't natively support composite keys for models.
So the migration would need to look more like this:
The unique() isn't really needed, but you can include it if you want to enforce referential integrity.
25 replies