title: Laravel: how to check middleware in blade template
body: <p>i've created Middleware</p>
  
  <pre><code>php artisan make:middleware isTeacher
  </code></pre>
  
  <p>in App/Http/isTeacher.php i've placed the check:</p>
  
  <pre><code>namespace App\Http\Middleware;
  
  use Closure;
  use Illuminate\Support\Facades\Auth;
  
  class isTeacher
  {
    public function handle($request, Closure $next)
    {
      $user = Auth::user();
  
      if($user &amp;&amp; $user-&gt;capability == 3)
      {
          return $next($request);
      }
      else
          return redirect('/login');
    }
  }
  </code></pre>
  
  <p>than, i've defined the middleware in app/Http/Kernel.php</p>
  
  <pre><code>protected $routeMiddleware = [
      ...
      'auth.teacher' =&gt; \App\Http\Middleware\isTeacher::class,
      ...
  ];
  </code></pre>
  
  <p>The question is: how I check the teacher capability in blade template?
  I'm trying with this:</p>
  
  <pre><code>@if (Auth::isTeacher())
  </code></pre>
  
  <p>but doesn't work</p>
  
  <p>any help are appreciated</p>