ppeasy/app/Http/Middleware/RegistrationEnabled.php

26 lines
506 B
PHP

<?php
namespace Vanguard\Http\Middleware;
use Closure;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class RegistrationEnabled
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (! setting('reg_enabled')) {
throw new NotFoundHttpException;
}
return $next($request);
}
}