How to integrate filament v3 with stored procedure
I want to use stored procedures for CRUD needs. But I'm confused about how to call the stored procedure function from the create/edit button, or when I want to display the resulting data from the stored procedure in a table. anyone can help ?
Solution:Jump to solution
I think I'm going to record a video about this concept. Do you mind if I include your question in the video?(including your discord user name).
Here's an example of using stored procedures to manage the users in a filament resource. First the create action
```php
// app/Filament/Resources/Pages/CreateUser.php
class CreateUser extends CreateRecord...
5 Replies
Do you need to use stored procedures for the table itself? Or just for the create, update and delete actions?
Solution
I think I'm going to record a video about this concept. Do you mind if I include your question in the video?(including your discord user name).
Here's an example of using stored procedures to manage the users in a filament resource. First the create action
Here's the
sp_insert_user
definition
Then, the edit action
here's the sp_update_user
definition
And finally the delete action. For this, use the ->action()
method in the DeleteAction
from the getHeaderActions()
function on the EditUser
class
As for the table itself. I don't think you should use a stored procedure to display the resulting data in a table. Reading from a table should not be restricted. And if, for some reason it is, the right way would be to create a database view that we can read from as if it was a normal table.Wow! Thank you for helping, even making a video. I have resolved the problem, but I just found out that you responded to the question and your video was on my YouTube.. Thank you very much for helping.
I have a stored procedure that returns the data to display (they are related in several tables) and I would like to use that result in the table to display for a resource, how should I implement it?