<?php

namespace App\Http\Middleware;

use Closure;

class BeforeMiddleware
{
    public function handle($request, Closure $next)
    {
        $response = $next($request);
        if(auth()->check()){
        	if(auth()->user()->status == 'suspend'){
        		return abort(401);
        	}
        	elseif(auth()->user()->expired_date < date('Y-m-d')){
        		return abort(403);
        	}
        }
        return $response;
    }
}