Route::middleware(['auth'])->group(function () { 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() {

Route::middleware(['first', 'second'])->group(function () {
    Route::get('/', function () {
        // Uses first & second Middleware
    });

    Route::get('user/profile', function () {
        // Uses first & second Middleware
    });
});