title: Middleware, how to redirect after check Laravel 5
body: <p>I need after check if user is logged as editor, to redirect to profile page...</p>
  <p>Here is my code:</p>
  <pre><code>&lt;?php namespace App\Http\Middleware;
  use Illuminate\Support\Facades\Auth;
  use Illuminate\Support\Facades\Redirect;
  
  use Closure;
  
  class AdminMiddleware {
  
      /**
       * Handle an incoming request.
       *
       * @param  \Illuminate\Http\Request  $request
       * @param  \Closure  $next
       * @return mixed
       */
      public function handle($request, Closure $next)
      {
          if (Auth::check()) {
              if (Auth::user()-&gt;roles-&gt;toArray()[0]['role'] == 'editor'){
                  return redirect('/profile');
              }
                  return $next($request);
              }
              else { 
                  return $next($request);
              }
          }
      }
  </code></pre>
  <p>Problem with this code is when user is editor I get infinite loop....</p>
  <p>Here is my routs:</p>
  <pre><code>Route::group(['middleware' =&gt; 'auth'], function(){
  
      Route::get('home', ['middleware' =&gt; 'admin', function()
          {
          return view('home');
          }]);
      Route::get('profile', array(
         'as' =&gt; 'profile',
         'uses' =&gt; 'UserController@getProfile'
      ));
  
  
  });
  </code></pre>
  <p>Anyone know what is problem?</p>