Damien
How do I make a table column searchable based on its state value?
My apologies for misunderstanding and potentially not explaining myself clearly enough.
My end goal is to be able to search for a clients name (first_name/last_name) on my project resource table.
What exactly are you trying to achieve here? Are you loading the data (first_name + last_name) from a relationship? If yes, there are better ways to do this.At the moment no, the
id
value of the client is returned and then I formateStateUsing
the id
to get the client details and render the name.
It doesn't really matter if it's current or related table 🙂 What matters is the SQL query you will write. In your case, you have to specifically define the table/relationship you are searching inI do have a relationship defined but I will assume it is wrong somewhere as it is not working correctly.
12 replies
How do I make a table column searchable based on its state value?
So this would work if I was searching on the contact resource but I am searching on a different resource where the default value is the id of the contact and not the name values.
This is why I use the formateStateUsing method and not sure how to make the above work with values from another table.
12 replies
How do I access / create relationships in custom actions that uses the createOptionForm method.
My apologies if I described my issue unclearly.
The snippet of code I shared, is for when I create a
project
from a contacts
detail view.
I have my contact, who currently has 0 projects. I want to be able to add a project for the contact
- I have a custom widget, with an action defined that allows me to do so.
However, I have an issue when it comes to project types and the reason I thought it was filament is when I get this error Call to a member function isRelation() on null
it points me to this part of my code:
<x-filament-actions::modals/>
It only errors if I uncomment the following line:
->relationship('projectType', 'type')
This code is exactly as it is in my ProjectResource, and I have a method on the Project model for projectType
but it is is only when I lift the code and move it to my custom widget that it breaks.
Does that help explain the issue a little better?7 replies
Is it possible to pre-populate this form with some data?
I am having a really hard time getting anything to work at the moment. Any
new Form
I try and create requires livewire
I've come back to it after a bit of time off and just struggling to get my brain into gear.31 replies
Is it possible to pre-populate this form with some data?
I think I follow.
$form
is a required param so I needs to get the form that the ContactResource uses.
The syntax came from Dan in another thread but I guess I can just build a form in there?31 replies
Is it possible to pre-populate this form with some data?
Ah, so I found the original thread where I picked up / discussed the syntax I shared above: https://discord.com/channels/883083792112300104/1204006622750318632
However, I also noted that this is similar to an issue I was having and Dan was helping me with. So moving more inline to what you have suggested, and Dan previously, I now have this code:
and
However I am getting an error around relationships:
31 replies