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)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay