zen69
zen69
FFilament
Created by zen69 on 11/29/2023 in #❓┊help
Select value when using allowHtml
Hello! I'm using allowHtml on my selection with a relationship. My issue is, since I'm rendering the options with the user avatar and name, The value passed is no longer the id that I need, but the whole Html used to render the options. My question is how can I get just the value without the html please:
Select::make('user_id')
->label(fn() => __('Collaborateur'))
->allowHtml()
->relationship(
name: 'user',
titleAttribute: 'name',
modifyQueryUsing: fn(Builder $query) => $query>withoutRoles([
config('filament-shield.super_admin.name'), config('filament-shield.panel_user.name')
])

)->searchable(['name', 'email'])
->searchPrompt(__('Rechercher par nom ou email'))
->getOptionLabelFromRecordUsing(fn(Model$record) => Blade::render(
'<x-filament::avatar
src="' . filament()>getUserAvatarUrl($record) . '"
size="sm"
class="inline mr-2"
/> ' . $record?->name . ' - ' . $record->email
)
)->required()
Select::make('user_id')
->label(fn() => __('Collaborateur'))
->allowHtml()
->relationship(
name: 'user',
titleAttribute: 'name',
modifyQueryUsing: fn(Builder $query) => $query>withoutRoles([
config('filament-shield.super_admin.name'), config('filament-shield.panel_user.name')
])

)->searchable(['name', 'email'])
->searchPrompt(__('Rechercher par nom ou email'))
->getOptionLabelFromRecordUsing(fn(Model$record) => Blade::render(
'<x-filament::avatar
src="' . filament()>getUserAvatarUrl($record) . '"
size="sm"
class="inline mr-2"
/> ' . $record?->name . ' - ' . $record->email
)
)->required()
7 replies
FFilament
Created by zen69 on 11/25/2023 in #❓┊help
render hook livewire component: pass current record
I'm rendering a livewire component in my view page. How do I pass the current record to the component please ?
3 replies
FFilament
Created by zen69 on 3/14/2023 in #❓┊help
Add attribute data-testid to components
4 replies