Route::group([ 'middleware' => 'api', 'prefix' => 'auth' ], code example

Example 1: Route::group(['middleware'=>'auth'], function() {

Route::group(['middleware' => ['auth']], function () { 
    Route::get('home', 'HomeController@index');
    Route::post('save-user', 'UserController@saveUser');
    Route::put('edit-user', 'UserController@editUser');
});

Example 2: Route::group(['middleware'=>'auth'], function() {

protected function mapAuthRoutes()
{
    Route::middleware('web')
        ->namespace('App\Http\Controllers\Auth')
        ->group(base_path('routes/auth.php'));
}

Tags:

Misc Example