<?php

namespace App\Http\Middleware;

use Closure;
use Auth; //at the top
class seller
{
    function handle($request, Closure $next, $guard = null)
  {
      if(Auth::check()){
          $role = Auth::user()->user_type;
          switch ($role) {
              case 'seller':
                  return $next($request);
                  break;
              default:
                  return response()->view('errors.403', [], 403);
                  break;
          }
      }
    return redirect()->guest('login');
    
  }
}