Wednesday, March 1, 2017

Why the list of routes is bigger than the routes declared into the routes/web.php file?

I am pretty new to Laravel and I have the following doubt.

If I perform the php artisan route:list statment to obtain the list of all the routes on my Laravel website I obtain this output:

$ php artisan route:list
+--------+-----------+----------------------------------+----------------------+-----------------------------------------------------+--------------+
| Domain | Method    | URI                              | Name                 | Action                                              | Middleware   |
+--------+-----------+----------------------------------+----------------------+-----------------------------------------------------+--------------+
|        | GET|HEAD  | /                                |                      | Closure                                             | web          |
|        | GET|HEAD  | api/user                         |                      | Closure                                             | api,auth:api |
|        | POST      | contact                          |                      | App\Http\Controllers\EnquiryController@index        | web          |
|        | GET|HEAD  | contact                          |                      | Closure                                             | web          |
|        | POST      | registration                     | registration.store   | App\Http\Controllers\RegistrationController@store   | web          |
|        | GET|HEAD  | registration                     | registration.index   | App\Http\Controllers\RegistrationController@index   | web          |
|        | GET|HEAD  | registration/create              | registration.create  | App\Http\Controllers\RegistrationController@create  | web          |
|        | PUT|PATCH | registration/{registration}      | registration.update  | App\Http\Controllers\RegistrationController@update  | web          |
|        | GET|HEAD  | registration/{registration}      | registration.show    | App\Http\Controllers\RegistrationController@show    | web          |
|        | DELETE    | registration/{registration}      | registration.destroy | App\Http\Controllers\RegistrationController@destroy | web          |
|        | GET|HEAD  | registration/{registration}/edit | registration.edit    | App\Http\Controllers\RegistrationController@edit    | web          |
+--------+-----------+----------------------------------+----------------------+-----------------------------------------------------+--------------+

but into the routes/web.php file I only have declared these stuff:

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('contact', function() {
    return View::make('contact');
});

Route::post('contact', 'EnquiryController@index');


Route::resource('/registration', 'RegistrationController');

So it seems that the number of the effective routes is greater that the routes effectively declared into the routes/web.php file.

Why? Maybe it could depend by this specific definition?

Route::resource('/registration', 'RegistrationController');




via blablabla blablabla

Advertisement