title: Laravel 5.3: localhost redirected you too many times
body: <p>I have 2 user roles which is <code>superadmin</code> and <code>admin</code></p>
  
  <p>I don't want <code>admin</code> to access of Settings Page.</p>
  
  <p>I am not sure if this is the proper way.</p>
  
  <hr>
  
  <p>So, here's my SettingsController.php</p>
  
  <pre><code>class SettingsController extends Controller {
      public function index() {
          if(Auth::user()-&gt;roles == 0) {
              return redirect(url()-&gt;previous());
          } else {
              return view('settings.index');
          }
      }
  }
  </code></pre>
  
  <p>As you can see if the <code>roles</code> is 0. I redirect the user to the last page they're in. I also tried to use <code>return back()</code>;</p>
  
  <hr>
  
  <p>web.php (routes)</p>
  
  <pre><code>&lt;?php
  
  Route::get('/', ['uses' =&gt; 'UsersController@index']);
  Route::post('login', ['uses' =&gt; 'UsersController@login']);
  
  Route::group(['middleware' =&gt; ['auth']], function() {
      Route::get('logout', ['uses' =&gt; 'UsersController@destroy']);
      Route::get('upline', ['uses' =&gt; 'UplinesController@index']);
      Route::get('upline/create', ['uses' =&gt; 'UplinesController@create']);
      Route::post('upline', ['uses' =&gt; 'UplinesController@store']);
      Route::delete('upline/destroy/{id}', ['uses' =&gt; 'UplinesController@destroy']);
      Route::put('upline/update/{id}', ['uses' =&gt; 'UplinesController@update']);
      Route::get('upline/getdownlines/{id}', ['uses' =&gt; 'UplinesController@getDownlines']);
  
      Route::get('downline', ['uses' =&gt; 'DownlinesController@index']);
      Route::post('downline', ['uses' =&gt; 'DownlinesController@store']);
      Route::delete('upline/destroy/{id}', ['uses' =&gt; 'DownlinesController@destroy']);
      Route::put('downline/update/{id}', ['uses' =&gt; 'DownlinesController@update']);
  
      Route::get('bonus', ['uses' =&gt; 'BonusController@index']);
      Route::post('bonus/csv', ['uses' =&gt; 'BonusController@fileUpload']);
  
      Route::get('settings', ['uses' =&gt; 'SettingsController@index']);
  });
  </code></pre>
  
  <p>I have a 2nd question. Can I limit admin using middleware? If yes, how? </p>
  
  <p>Any help would be appreciated.</p>