title: Create superAdmin middleware in Laravel 5.1
body: <p>I need to create SuperAdmin middleware in my app called 'master' so I make middleware 'IsMaster' :</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Middleware;
  
  use Closure;
  
  class IsMaster
  {
      /**
       * Handle an incoming request.
       *
       * @param  \Illuminate\Http\Request  $request
       * @param  \Closure  $next
       * @return mixed
       */
      public function handle($request, Closure $next)
      {
          if (\Auth::user() &amp;&amp;  \Auth::user()-&gt;admin == 101) {
              return $next($request);
          }
  
          return redirect('/auth/logout');
      }
  }
  </code></pre>
  
  <p>so as you can see from the code above if 'admin' field in my 'users' table has value 101 that is MASTER user.</p>
  
  <p>Now I add this to Kernel.php:</p>
  
  <pre><code>protected $routeMiddleware = [
          'auth' =&gt; \App\Http\Middleware\Authenticate::class,
          'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
          'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
          'admin' =&gt; \App\Http\Middleware\IsAdmin::class,
          'master' =&gt; \App\Http\Middleware\IsMaster::class,
  
      ];
  </code></pre>
  
  <p>now at AdminController.php I use it like:</p>
  
  <pre><code>class AdminController extends Controller
  {
  
      public function __construct() {
          $this-&gt;middleware('master', ['except' =&gt; ['getMail']]);
      }
  
  ...
  </code></pre>
  
  <p>when I try to login with master user account I got error:</p>
  
  <blockquote>
    <p>ReflectionException in Container.php line 741: Class master does not
    exist</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/fZcYx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fZcYx.png" alt="enter image description here"></a></p>
  
  <p>What is a problem here? I really dont see what make the issues...</p>
  
  <p>Also I try: php artisan config:clear, php artisan cache:clear ...</p>