Roberto S.
Roberto S.
FFilament
Created by Roberto S. on 10/22/2024 in #❓┊help
Add Action to Select modal create and update
I have a form with a Template entity and a Select field for the Sender entity which is a table with SMTP data for sending emails. The Sender field is defined like this:
Select::make('sender')
->label(__('From'))
->relationship('sender', 'name')
->searchable()
->preload()
->createOptionForm(Sender::getFormSchema())
->editOptionForm(Sender::getFormSchema())
Select::make('sender')
->label(__('From'))
->relationship('sender', 'name')
->searchable()
->preload()
->createOptionForm(Sender::getFormSchema())
->editOptionForm(Sender::getFormSchema())
But I would like to add to the Actions of the modal a TEST CONFIG button to test the configuration. The problem is that I don't see how to add this Action to the modal from the Select. Any idea?
3 replies
FFilament
Created by Roberto S. on 10/14/2024 in #❓┊help
Markdown editor with custom buttons
I'm working with the Markdown editor with custom buttons. My goal is to create a dropdown button in the editor that allows inserting placeholders into the text. These placeholders would later be substituted with the actual values of those variables. Any advice, resources, or code examples would be greatly appreciated. Thanks in advance!
2 replies
FFilament
Created by Roberto S. on 6/26/2024 in #❓┊help
SelectFilter by 2 level relationship
I want to make a SelectFilter by country in a table where I show vehicles. The data model is as follows: Vehicle - id - name - place_id Place - id - name - country_id Country - id - code - name That is, a Vehicle belongs to a Place and a Place has a Country. My current code is as follows, the filter shows it but the changes are not applied:
SelectFilter::make('place.country.code')
->label(__('Country'))
->options(fn () => Country::pluck('name', 'code')->toArray())
->multiple()
->searchable()
->preload(),
SelectFilter::make('place.country.code')
->label(__('Country'))
->options(fn () => Country::pluck('name', 'code')->toArray())
->multiple()
->searchable()
->preload(),
Thanks
24 replies
FFilament
Created by Roberto S. on 6/10/2024 in #❓┊help
Hide and set value don't work simultaneously
I have a Form with two fields, redeemer_type and redeemer_id and I want to set the redeemer_id to NULL and hide it when the redeemer_type is null. My code works fine if I comment the hidden part of the redeemer_id, any ideas?
Select::make('redeemer_type')
->label(__('Type'))
->options([
User::class => __('User'),
])
->afterStateUpdated(fn (Get $get, Set $set) => $set('redeemer_id', null))
->live(),

Select::make('redeemer_id')
->label(__('User'))
->getSearchResultsUsing(fn (string $search): array => User::query()
->where('name', 'like', "%{$search}%")
->where('is_admin', false)
->limit(10)
->pluck('name', 'id')
->toArray()
)
->getOptionLabelUsing(fn ($value): ?string => User::find($value)?->name)
// ->hidden(fn (Get $get): bool => $get('redeemer_type') !== User::class)
->searchable(),
Select::make('redeemer_type')
->label(__('Type'))
->options([
User::class => __('User'),
])
->afterStateUpdated(fn (Get $get, Set $set) => $set('redeemer_id', null))
->live(),

Select::make('redeemer_id')
->label(__('User'))
->getSearchResultsUsing(fn (string $search): array => User::query()
->where('name', 'like', "%{$search}%")
->where('is_admin', false)
->limit(10)
->pluck('name', 'id')
->toArray()
)
->getOptionLabelUsing(fn ($value): ?string => User::find($value)?->name)
// ->hidden(fn (Get $get): bool => $get('redeemer_type') !== User::class)
->searchable(),
7 replies
FFilament
Created by Roberto S. on 1/10/2024 in #❓┊help
Tailwind colors doesn't work
Hi, I have a simple panel in Filament 3, and when I add some Custom Columns with Tailwind colours, it doesn't show them. Do you know what can it be? Test HTML code:
<div>
<span class="inline-flex items-center rounded-md bg-gray-50 px-2 py-1 text-xs font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-red-600/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-yellow-50 px-2 py-1 text-xs font-medium text-yellow-800 ring-1 ring-inset ring-yellow-600/20">Badge</span>
<span class="inline-flex items-center rounded-md bg-green-50 px-2 py-1 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20">Badge</span>
<span class="inline-flex items-center rounded-md bg-blue-50 px-2 py-1 text-xs font-medium text-blue-700 ring-1 ring-inset ring-blue-700/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-indigo-50 px-2 py-1 text-xs font-medium text-indigo-700 ring-1 ring-inset ring-indigo-700/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-purple-50 px-2 py-1 text-xs font-medium text-purple-700 ring-1 ring-inset ring-purple-700/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-pink-50 px-2 py-1 text-xs font-medium text-pink-700 ring-1 ring-inset ring-pink-700/10">Badge</span>
</div>
<div>
<span class="inline-flex items-center rounded-md bg-gray-50 px-2 py-1 text-xs font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-red-600/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-yellow-50 px-2 py-1 text-xs font-medium text-yellow-800 ring-1 ring-inset ring-yellow-600/20">Badge</span>
<span class="inline-flex items-center rounded-md bg-green-50 px-2 py-1 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20">Badge</span>
<span class="inline-flex items-center rounded-md bg-blue-50 px-2 py-1 text-xs font-medium text-blue-700 ring-1 ring-inset ring-blue-700/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-indigo-50 px-2 py-1 text-xs font-medium text-indigo-700 ring-1 ring-inset ring-indigo-700/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-purple-50 px-2 py-1 text-xs font-medium text-purple-700 ring-1 ring-inset ring-purple-700/10">Badge</span>
<span class="inline-flex items-center rounded-md bg-pink-50 px-2 py-1 text-xs font-medium text-pink-700 ring-1 ring-inset ring-pink-700/10">Badge</span>
</div>
7 replies