Toni
Toni
FFilament
Created by Toni on 8/6/2024 in #❓┊help
Empty field on condition
I have the following schema:
Toggle::make('notify_unlock')
->label(__('form.labels.notifyUnlock'))
->live()
->columnSpan(1),
Select::make('notify_unlock_mail_template_id')
->label(__('form.labels.notifyUnlockMailTemplate'))
->options(MailTemplate::query()->where('is_published','=',1)->pluck('name', 'id'))
->required()
->visible(fn(Get $get) => $get('notify_unlock'))
->columnSpan(2)
Toggle::make('notify_unlock')
->label(__('form.labels.notifyUnlock'))
->live()
->columnSpan(1),
Select::make('notify_unlock_mail_template_id')
->label(__('form.labels.notifyUnlockMailTemplate'))
->options(MailTemplate::query()->where('is_published','=',1)->pluck('name', 'id'))
->required()
->visible(fn(Get $get) => $get('notify_unlock'))
->columnSpan(2)
I want to empty the select box if the toggle button notify_unlock is false. As far I tried: - dehydrateStateUsing - beforeStateDehydrated None of them set the value of the Selectbox to null. Kind regards, Toni
5 replies
FFilament
Created by Toni on 7/8/2024 in #❓┊help
html content stripped out of modal action
This is how it should look like
5 replies
FFilament
Created by Toni on 6/24/2024 in #❓┊help
Symfony Expression Language with Filamentphp
Has anyone ever used Symfony Expression Language with Filamentphp? Or any other similar product?
2 replies
FFilament
Created by Toni on 6/9/2024 in #❓┊help
ManyToMany Relationship via Select element
Why do I have to set a Select-Element to ->multiple() in case of belongsToMany? The use case why I am asking is, that I have a manyToMany relationship between users and institutes. - In case a user has a system role, no relationship is needed - In case a user has a monocentric role, the relationship is oneToMany (seen from a institute perspective) - In case a user has a multicentric role, the relationship turns into manyToMany. I would like to solve this with a Select-Element and make it multiple or not, depending on the role. But if multiple is false, I got an error message:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'institutes' in 'field list' (Connection: mysql, SQL: update `users` set `institutes` = 2, `users`.`updated_at` = 2024-06-09 15:39:09 where `id` = 1)
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'institutes' in 'field list' (Connection: mysql, SQL: update `users` set `institutes` = 2, `users`.`updated_at` = 2024-06-09 15:39:09 where `id` = 1)
If I turn the select element to multiple choice everything works fine, except of monocentric roles (I can attach more than one institute). What is the reason for this "limitation"?
2 replies
FFilament
Created by Toni on 6/2/2024 in #❓┊help
Experiencing odd behaviour with custom Actions
No description
24 replies
FFilament
Created by Toni on 6/1/2024 in #❓┊help
Sending notification after action
Hi, I have this action:
Actions\Action::make('Publish')
->label(__('mailtemplate.labels.publish'))
->action(fn () => MailHelper::publishMailTemplate($this->record))
->successNotification(
Notification::make('published')
->title(__('mailtemplate.notifications.published'))
->success()
)
->visible(fn () => !$this->record->is_published),
Actions\Action::make('Publish')
->label(__('mailtemplate.labels.publish'))
->action(fn () => MailHelper::publishMailTemplate($this->record))
->successNotification(
Notification::make('published')
->title(__('mailtemplate.notifications.published'))
->success()
)
->visible(fn () => !$this->record->is_published),
After a successful performance I would the notification, but nothing happens. What do I miss? Thanky you
6 replies