Augus
Sorting ignores relation condition
Hi,
I have been trying to get this to work but im stuck.
Basically i got a relation on my record called 'animals' and on the table i need to have several counts of this object with different conditions, like so:
Initially i had a custom attribute:
But i was unable to sort on this.
Then i figured maybe im able to push this logic to the database and add a virtual column with the count where active is true. But couldn't find any resource on how to do this.
So now i tried the sortable function but somehow when i sort it orders by the actual 'animals_count' (makes sense given the function). But this discards the "where animal is active".
Basically now im stuck and have not really an idea how to move forward... Anyone has experience with this of has some ideas?
22 replies
Add shared data to Infolist Livewire fields
I am using custom LiveWire components in my Infolist which look like so:
But both of those components are making an identical call in the mount() function like so:
and
So i wanted to create the variable $data in the infolist function but i am unable to access the resource here.
Wanted situation:
And then i would call the Livewire components as followed:
All this would be to not call the same Animal function on one page (since this is an API call to a third party). How would i be able to create an $data variable like above to pass to multiple Livewire fields in my infolist?
25 replies
Relationship not saved to Model on Section
In my UserResource i got a Section as followed:
This does create a new contact when i fill in the needed fields, but it does not attach that contact to my User.
User Model:
Contact Model:
My users table has an field which should be filled with the created contact. But it isn't.
I think the issue is somewhere in my code but for the love of me im not able to see it.
10 replies
Live function does not empty radio field
What I am trying to do:
I want to have the Radio field 'ubn' be emptied whenever i change the select field 'relation'.
Do note that the Radio options are filled with the Select change as seen in the options function of that field.
What I did:
I tried adding the afterStateUpdated to the select field as shown in the example, this was my best guess.
Also tried the dehydrateStateUsing on the Radio field but that would empty it always.
My issue:
My issue is that although visually the radio is deselected whenever i change the Select field. But the Radio is not deselected on the "backend" as in it will go trough validation and i can still access it via the Get $get.
Code:
3 replies
Custom error pages
So in the past i used https://v2.filamentphp.com/tricks/custom-laravel-error-pages for my custom error pages and this worked great.
But this doesn't work anymore with V3. I have been trying to get started with several filament components (panel:s:page, panels::layout, etc) but they either need an $this or they are missing Livewire.
Which all make sense but what would be the best approach to create a proper 404 page inside Filament.
21 replies
Select field issues with combination of Live + Disabled.
So i have been playing around whole night to get this to work but im simply not able to.
What i want to do is pretty simple though;
1. I want to have the "Location" (UBN) select field to be disabled.
2. User selects a "Contact" (Relatie) in the first select field.
3. When a "Contact" is selected i want to search for all related "Location" objects for that contact and place them in field 2 as options.
3. When options are loaded or when User selected the "Contact" in field #1 i want to enable field #2.
4. User selects "Location" (UBN)
Above simply does not load any options for field #2 (UBN) but this is mainly because the
->disabled(empty($this->data['relation']))
cause removing this let's both fields work as expected. But you can imagine that having the second field disabled when there is no option selected in the first field would be more user friendly.
Am i doing something wrong or is this simply not possible?10 replies
Create 'check' step inside wizard.
How would i approach adding an 'check' step inside a wizard?
- The user needs to confirm the data he/she filled in.
- I need to be able to call an function based on the form fields to show an error message or primary message on the last step.
Is there a confirm step i can use or ideally create a last step within the wizard?
I tried this with placeholder fields in a last step but since the function i want to call makes an API call i only want to call this in the end and not on every wizard step (what it's doing now).
4 replies
Get SOAP data in Filament
So i got some connections with a really old SOAP client where i wanna show the data (array) in Filament (i don't need to process it or anything just showing).
My idea was to create a Model with the data and Hydrate it from the SOAP data, but for the love of me i can't seem to find the proper way to do this.
So my question is, is the hydration way a proper path to do this and how would i approach this in Filamentphp (keep in mind for now i only care about showing the data).
Or is there a better way to create a Filamentphp Table/list page with this raw array data?
5 replies
V3 Tabs set default
Regarding to the Tabs for listing records (https://beta.filamentphp.com/docs/3.x/panels/resources/listing-records) is it possible to set an default tab that's not the first record? And if not how can i make a feature request to get this in?
4 replies
Is this a bug or intended behaviour? (Select relationship)
So i got the following select field, do note that 'full_name' is an virtual column:
Just to be sure the virtual column:
But when i got a Resource where the already select Ram is not active anymore it doesn't show the 'full_name' but the ID of that Ram.
I would suspect that it would still show the 'full_name' cause i see no reason why not.
I got it fixed myself though by adding the following, but again i think it shouldn't have to:
This shows the 'full_name' even though the Ram is not active anymore.
25 replies
Issue with search on relation & attribute as select name.
So i got a bit complicated select question:
I want to make an select field which has a relation with the ram relation (hasOne Animal). Where i can search the field based on country_code/registration_number/name. The 'select_name' is an attribute set in the model as followed:
But with the given code i get the following error, which makes sense but i don't really got a clue on how to solve it.
38 replies