Resource controllers and endpoints

The recommended table from Laravel.

Very useful to apply in other frameworks or custom apps too:

Actions Handled By Resource Controller

Route name is bound as “class”.”method” on the controller file.

VerbPathActionRoute Name
GET/resourceindexresource.index
GET/resource/createcreateresource.create
POST/resourcestoreresource.store
GET/resource/{id}showresource.show
GET/resource/{id}/editeditresource.edit
PUT/PATCH/resource/{id}updateresource.update
DELETE/resource/{id}destroyresource.destroy

Summary:

Route NameAction
resource.index/resourceDisplay a listing of the resource.
resource.create/resource/create Show the form for creating a new resource.
resource.store/resourceStore a newly created resource in storage.
resource.show/resource/{id}show
resource.edit/resource/{id}/editShow the form for editing the specified resource.
resource.update/resource/{id}Update the specified resource in storage.
resource.destroy/resource/{id}destroy

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s