<?php

namespace App\Http\Middleware\Mobile;

use Closure;

class MobileMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if(auth()->user()->getRole() === 'mob')
            return $next($request);
        else {
            return  redirect()->route('home');
        }
    }
}
