DEV Community

Bijay Kumar Pun
Bijay Kumar Pun

Posted on

Binding a resource controller in Laravel

What is resource controller?
Laravel has some conventions/rules for all of the routes of a traditional REST/CRUD controller called resource controller. Laravel also comes with a generator out of the box and a convenient route definition that allows binding an entire resource controller at once.
Simply put, resource controller is used when all CRUD operations are performed. Meanwhile, if performed manually, then plain controllers are used.

To generate recource controller:
php artisan make:controller MySampleResourceController --resource

Resource Controller Binding
// routes/web.php
Route::resource('tasks','TasksController');

To list all the route:
php artisan route:list

Top comments (0)

👋 Kindness is contagious

Dive into this informative piece, backed by our vibrant DEV Community

Whether you’re a novice or a pro, your perspective enriches our collective insight.

A simple “thank you” can lift someone’s spirits—share your gratitude in the comments!

On DEV, the power of shared knowledge paves a smoother path and tightens our community ties. Found value here? A quick thanks to the author makes a big impact.

Okay