Damien
Damien
FFilament
Created by Damien on 4/24/2024 in #❓┊help
How do I make a table column searchable based on its state value?
This is working now and looks like this:
TextColumn::make('client.full_name')
->label('Client')
->sortable()
->searchable(),
TextColumn::make('client.full_name')
->label('Client')
->sortable()
->searchable(),
Thank you all
12 replies
FFilament
Created by Damien on 4/24/2024 in #❓┊help
How do I make a table column searchable based on its state value?
I will look at this, thank you Leandro
12 replies
FFilament
Created by Damien on 4/24/2024 in #❓┊help
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 in
I do have a relationship defined but I will assume it is wrong somewhere as it is not working correctly.
12 replies
FFilament
Created by Damien on 4/24/2024 in #❓┊help
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
FFilament
Created by Damien on 4/24/2024 in #❓┊help
How do I make a table column searchable based on its state value?
Thank you Modestas, I will have a look at this now!
12 replies
FFilament
Created by Damien on 4/24/2024 in #❓┊help
How do I make a table column searchable based on its state value?
Anyone able to help point me in the right direction for this? It would be much appreciated.
12 replies
FFilament
Created by Damien on 4/22/2024 in #❓┊help
How do I access / create relationships in custom actions that uses the createOptionForm method.
That's okay thank you, I will try my hand at debugging it further and seeing if it is indeed compatiable, hopefully so!
7 replies
FFilament
Created by Damien on 4/22/2024 in #❓┊help
How do I access / create relationships in custom actions that uses the createOptionForm method.
I am having a look throught that link now.
7 replies
FFilament
Created by Damien on 4/22/2024 in #❓┊help
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
FFilament
Created by Damien on 4/16/2024 in #❓┊help
Is it possible to pre-populate this form with some data?
Thank you so much!
31 replies
FFilament
Created by Damien on 4/16/2024 in #❓┊help
Is it possible to pre-populate this form with some data?
adding this to the action:
->fillForm([
'name' => 'John Doe',
])
->fillForm([
'name' => 'John Doe',
])
Does indeed fill the the name field. So I just have to change it to the fields I want to populate and we should be good!
31 replies
FFilament
Created by Damien on 4/16/2024 in #❓┊help
Is it possible to pre-populate this form with some data?
gotcha, sorry, I did that previously but it didn't show, I think I must have been missing something else. that is however now rendering a form.
31 replies
FFilament
Created by Damien on 4/17/2024 in #❓┊help
Is there a way to prevent soft deleted records appearing in global search?
This appears to have worked thank you.
10 replies
FFilament
Created by Damien on 4/17/2024 in #❓┊help
Is there a way to prevent soft deleted records appearing in global search?
Ok ill try this, is this on the project resource level?
10 replies
FFilament
Created by Damien on 4/16/2024 in #❓┊help
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
FFilament
Created by Damien on 4/16/2024 in #❓┊help
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
FFilament
Created by Damien on 4/16/2024 in #❓┊help
Is it possible to pre-populate this form with some data?
How do you mean sorry? The public method in my ContactResource?
31 replies
FFilament
Created by Damien on 4/16/2024 in #❓┊help
Is it possible to pre-populate this form with some data?
Here is the error:
Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, called in /var/www/html/vendor/filament/forms/src/Components/Select.php on line 773
Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, called in /var/www/html/vendor/filament/forms/src/Components/Select.php on line 773
So it is complaining about null being received but I am unsure where this value comes from. Should I be defining a relationship?
31 replies
FFilament
Created by Damien on 4/16/2024 in #❓┊help
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:
<div class="space-y-4 divide-y-2">
<div class="flex items-center justify-between">
<p class="font-bold text-xl">Contacts</p>
{{ $this->createCompanyContactAction }}
</div>

<div class="grid gap-4 grid-cols-1 auto-rows-auto pt-4 divide-y divide-dashed">
@foreach($record->contacts as $contact)
<x-company-resource.contacts-overview.contacts-card-contact :contact="$contact"/>
@endforeach
</div>

<x-filament-actions::modals/>
</div>
<div class="space-y-4 divide-y-2">
<div class="flex items-center justify-between">
<p class="font-bold text-xl">Contacts</p>
{{ $this->createCompanyContactAction }}
</div>

<div class="grid gap-4 grid-cols-1 auto-rows-auto pt-4 divide-y divide-dashed">
@foreach($record->contacts as $contact)
<x-company-resource.contacts-overview.contacts-card-contact :contact="$contact"/>
@endforeach
</div>

<x-filament-actions::modals/>
</div>
and
<?php

namespace App\Filament\Resources\CompanyResource\Widgets;

// ...

class ContactsOverview extends Widget implements HasActions, HasForms
{
use InteractsWithActions;
use InteractsWithForms;

protected static string $view = 'filament.resources.company-resource.widgets.contacts-overview';

public ?Model $record = null;

public function createCompanyContactAction(): Action
{
return Action::make('createCompanyContact')
->label('Add Contact')
->record($this->record)
->form(fn ($form) => ContactResource::form($form))
return Action::make('createCompanyContact')
->label('Add Contact')
->record($this->record)
->form(fn ($form) => ContactResource::form($form))
->action(function () {
dd('Create Company Contact Action');
});
}
}
<?php

namespace App\Filament\Resources\CompanyResource\Widgets;

// ...

class ContactsOverview extends Widget implements HasActions, HasForms
{
use InteractsWithActions;
use InteractsWithForms;

protected static string $view = 'filament.resources.company-resource.widgets.contacts-overview';

public ?Model $record = null;

public function createCompanyContactAction(): Action
{
return Action::make('createCompanyContact')
->label('Add Contact')
->record($this->record)
->form(fn ($form) => ContactResource::form($form))
return Action::make('createCompanyContact')
->label('Add Contact')
->record($this->record)
->form(fn ($form) => ContactResource::form($form))
->action(function () {
dd('Create Company Contact Action');
});
}
}
However I am getting an error around relationships:
31 replies
FFilament
Created by Damien on 4/18/2024 in #❓┊help
Styling forms modal forms created with createOptionsForm()
That worked thanks, the Grid was the missing key!
18 replies