Here are some notes for setting up resourceful routing.

Setting up the route file

This is an example for a controller called Projects.

Route::resource('projects', 'ProjectController');

Next to create this resourceful controller

I recommend using the -m to also create a model at the same time.

php artisan make:controller ProjectsController -r -m Project

The -r makes the controller resourceful which means it adds some boilerplate data for making get, post, put, etc…in that controller. The -m and following name and I’ve found that it’s easiest to add this for any controller I make at this stage rather than needing to do it later.

Article Tags:
Article Categories:

Web developer and former photographer by trade...gamer and all around tech enthusiast in his free time. Christoph started sdatic.com as a way to organize his ideas, research, notes and interests. He also found it enjoyable to connect and share with others who parallel his interests. Everything you see here is a resource that he found useful or interesting and he hopes that you will too.

Leave a Reply

Your email address will not be published. Required fields are marked *