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)