ChrisB
ChrisB
FFilament
Created by ChrisB on 3/18/2024 in #❓┊help
RelationManager afterSave() Question
I can get afterSave to work when added to the edit page of a resource, but I can't seem to get it working when added to the ResourceManage page. I assume I've missed something obvious. Any help appreciated.
6 replies
FFilament
Created by ChrisB on 2/8/2024 in #❓┊help
Contents of a Select using SQL type query
I'm sorry for the fundamental nature of this query, but I'm still piecing Filament / Laravel together this is another of those scenarios that has me confused. I know there are relationship scenarios on this, but I'd like to understand the wider flexibility for a query like this. Basically, in the code below, how would I extract another value of the form and place it in to that position in the where query. I have worked out if I add "auth()->user()->id" in there, it works fine, however that isn't the value I'm after.
Select::make('userpermission_id')
->options(UserPermissions::where('system_link',# INSERTED HERE NEEDS TO BE THE VALUE OF ANOTHER FIELD OF THE SAME FORM #)->pluck('permission_name', 'id'))
Select::make('userpermission_id')
->options(UserPermissions::where('system_link',# INSERTED HERE NEEDS TO BE THE VALUE OF ANOTHER FIELD OF THE SAME FORM #)->pluck('permission_name', 'id'))
Thanks in advance.
5 replies
FFilament
Created by ChrisB on 12/28/2023 in #❓┊help
Multiple Actions on Save
I'm new to Filament, and Laravel in general...sorry in advance if I've missed something elementary. I've got a long way on my own, but hit a brick wall on this one. Resource setup (with relationship too, but unrelated for this question), and working perfectly for creating, deleting and editing. At this point, my question relates to being in an existing record and making changes. When pressing save, I want to save the record + fire off a webhook to trigger a third party. I've fired up Webhooks, and can a call it from a separate action button on my form. I just can't combine them! The below code is located in my ''Edit Page' of the resource, and fires off my function to send the webhook. It doesn't save the record. Anyone able to show me how I can include the save command in the same action?
protected function getFormActions(): array
{
return [
$this->getSaveFormAction()
->label('Save and Trigger')
->submit(null)
->action(function (MyModel $new) {
$result = $new->MyTriggerFunction('Some Data');
Notification::make()
->title($result)
->success()
->send();
}),
$this->getCancelFormAction()
];
protected function getFormActions(): array
{
return [
$this->getSaveFormAction()
->label('Save and Trigger')
->submit(null)
->action(function (MyModel $new) {
$result = $new->MyTriggerFunction('Some Data');
Notification::make()
->title($result)
->success()
->send();
}),
$this->getCancelFormAction()
];
Thanks in advance.
7 replies