Customizing update process globally
Hi,
I have a CustomerResource. In my EditCustomer class I added handleRecordUpdate function.
In another resource I use a Select field to select a customer. In the field I added an editOptionForm. Unfortunately when I update the customer via the edit modal my handleRecordUpdate function is not being executed.
I saw there is a updateOptionUsing function for the select field but I do not want to copy the same code from handleRecordUpdate because whenever I change something there I have to update the code in updateOptionUsing as well.
Is there a way to have one single update handle function globally which is being executed no matter whether the record is being updated via edit page or actions or relations? I could not find any information in the docs.
Solution:Jump to solution
What about Eloquent events? https://laravel.com/docs/11.x/eloquent#events
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. Weβve already laid the foundation β freeing you to create without sweating the small things.
2 Replies
Solution
What about Eloquent events? https://laravel.com/docs/11.x/eloquent#events
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. Weβve already laid the foundation β freeing you to create without sweating the small things.
Thanks i will take a look at it