Files
izyim/app/Http/Middleware/Authentication.php
T
2019-03-19 17:11:21 +08:00

32 lines
746 B
PHP
Executable File

<?php
namespace App\Http\Middleware;
use Closure;
/**
* Class Authentication
*
* Copyright (C) 2018 buduxs. All rights reserved.
* @author Omair Saleh <uldvstar@gmail.com>
* @license Proprietary
*/
class Authentication {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next) {
// if the session does not contain the token, redirect back to the login
if (auth()->check() === false) {
return redirect()->route('login')->withErrors('Your session has expired. Please log in again.');
}
return $next($request);
}
}