A resource controller provides conventional actions for CRUD-style resources.
Typical actions are:
index
create
store
show
edit
update
destroy
Example:
Route::resource('products', ProductController::class);
This can generate conventional routes such as:
GET /products
POST /products
GET /products/{product}
PUT/PATCH /products/{product}
DELETE /products/{product}
Scenario:
An admin product-management module maps naturally to resource routing.
Interview follow-up:
Explain when you would not use resource routing—for example, when an endpoint represents an operation rather than a conventional CRUD resource.
0 comments:
Post a Comment
Thanks