For get
routes, I usually put the views in the directory structure corresponding to the name of the route. For instance. resources/views/teams/team/manage/index.blade.php
. However, I think this is too verbose.
I agree.
From the Laravel Docs :
Laravel uses the typical RESTful CRUD approach when assigning resource routes to a controller. Each verb (i.e. GET, POST, PUT, DELETE) receives a designated URI , an action (technically, a controller method) and a route name (sometimes, /path/to/blade/view
).
So from your snippet:
// return view(teams.index) Route::get('/teams', ' TeamController@index '); // return view(teams.create) Route::get('/teams/create', ' TeamsController@create '); // redirect('/home'); Route::post('/teams', ' TeamController@store '); // return view('teams.profile') Route::get('/teams/profile', ' TeamController@profile ')->name('profile');
I use this resource table to remind me what to do and what to do not all the time.
Perhaps checking out some of the great Laravel codebases might help. In addition, the prospect of how other teams do things is always priceless.
I found that they are very useful:
Update
The key must adhere to standard CRUD actions, i.e. index, display, create, save, edit, update and delete. Looks will fall right in their place.
Check out Adam Watan speaks at Laracon EU , demonstrating how CRUDDY can be with a little imagination.