The Resource in Laravel create methods for performing CRUD.
Methods are used to list, update, show, create and delete records.
For example, if you create a Resource for Userscontroller, you should have the methods index (get), create (get), store (post), edit (get), update (put), destroy (delete).
I want to create a new record in the database, I must use the verb POST to call the action store?
Yes, the Resource method equivalent to the "create" action is the store. The requested HTTP request method is POST.
The method create is just the interface for creating, so it’s a GET method.
I want to update an existing database record, I must use which verb, the action will store or update?
Should be update. The method update requires a request of type PUT. It is important to highlight this, because if you are using a request of the type Ajax, you will need to specify this method.
If I’m right, the update and Destroy action should be used to manipulate files in the file system. That’s right?
Not necessarily a file system. Resource actually aims to make it easier to create a CRUD, based on REST, where you have each url responsible for an action.
Usually used in Laravel update to update a record, and destroy, to remove.
Thank you very much for the enlightening explanation Wallace.
– Fábio Jânio