403gtfo
Pass filter data to Sushi model
I'm kind of bastardizing Sushi and making my own model data on the fly (with blackjack and hookers) 😛
Basically by forming an array in the sushi model some fields of which are calculations based on the filters like x number of y in year n. This allows me to use the searchable and sortable methods in the filament table which normally break when you use formateStateUsing().
So basically dynamic static sushi data fun time muahahahahahhaha
It works now and I am super happy about it. I just had to check for the empty start to address the reset button.
10 replies
Pass filter data to Sushi model
YES!!! I think I got it working. More testing required.
I found the filters in request() and it works!!!!!!
The true condition works on initial page load (as I have a default value in the filter.
the false condition is where the updated state is.
I need to add another filter to test if the [0] index goes walk about and make sure it doesnt lose it if another filter is changed... which I feel it might.
10 replies
Need two tabs with two different tables with two different models on one page
I'd take a look at this.
Make 2 livewire components that each create a table, and a view that includes them. Not sure how well it would go about insulating cross contamination. But that should get you started 🙂
https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component
2 replies
TextColumn throwing an exception for the empty ENUM value
I swear to the tech gods the number of times enums have caused my headaches during my filament projects. Unless you NEEEEED them, stay away and just control it in logic.
(Sorry not answering your question, but just ranting)
12 replies
Save changes not working for records with multiple ids?
Have you customized the edit form (other then adding fields and such)?
Otherwise 9 out of 10 times this happens to me is I forgot to add the additional field to the model's $fillable and am testing on different fields.
Try updating the same field on multiple records and see if it works.
Just a crazy thought.
3 replies
Call a function after change SelectFilter
Try ->afterStateUpdated( )
Link to Doco:
https://filamentphp.com/docs/3.x/forms/advanced#field-updates
3 replies
Dynamic Filter
I've done some similar stuff. You can use a combination of Get, hidden(), live(), and a function in your options()
Get - Gets another field's value
live() - lets the field update after load
hidden() - Use a function with some logic on pet_specie_id that uses Get to check pet_type_id. If pet_type_id is not set hide pet_specie_id
options() - again, use a function with logic in pet_specie_id that Gets pet_type_id and pulls the right option array.
There is probably a nicer way, but hope this puts you on the right path.
Also side note: if you add swift after the three backticks in your code block it will color code stuff like this:
Link to doco:
https://filamentphp.com/docs/3.x/forms/advanced#injecting-the-state-of-another-field
3 replies