moved wizard check to middleware
This commit is contained in:
31
app/Http/Middleware/RedirectIfWizardCompleted.php
Normal file
31
app/Http/Middleware/RedirectIfWizardCompleted.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class RedirectIfWizardCompleted
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
// Not in wizard
|
||||
if (!starts_with($request->getPathInfo(), '/wizard')) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
// Wizard not completed
|
||||
if (!setting('general.wizard', 0)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
// Wizard completed, redirect to home
|
||||
redirect()->intended('/')->send();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user