Файл: gapps/app/Http/Middleware/SentinelCheck.php
Строк: 41
<?php
/**
* AppHttpMiddlewareSentinelCheck
*
* Middleware for checking the current user login
*
* @package MyCMS
* @category SentinelCheck
* @author Anthony Pillos <dev.anthonypillos@gmail.com>
* @copyright Copyright (c) 2016
* @version v1
*/
namespace AppHttpMiddleware;
use Closure;
use Sentinel;
class SentinelCheck
{
/**
* Handle an incoming request.
*
* @param IlluminateHttpRequest $request
* @param Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Sentinel::getUser())
{
return $next($request);
}
$url = route('frontend.login').'?return-url=' . $request->url();
return redirect( $url );
}
}