virajkhatavkar
2 years ago
110
1
Laravel

Structure API Resource RESTfull Controllers

Posted 2 years ago by virajkhatavkar

I have a resource "License" which has a store method. What it essentially does is create a new record in the licenses table.

The caveat here is if I call the store from the client, it needs to just create a new record, but if it is called from admin, it needs to do this one thing before it adds to the table. I currently have a one resource controller which does this as there is no separate logic than this one small thing to do. Do I just check with isAdmin() or is there a better way to achieve this?

Please sign in or create an account to participate in this conversation.