Merge pull request #987 from SevanNerse/master
Middleware updated in order to decide that wizard is completed or not
This commit is contained in:
commit
6697a2f67b
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
@ -7,6 +6,7 @@ use Illuminate\Support\Str;
|
||||
|
||||
class RedirectIfWizardCompleted
|
||||
{
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
@ -16,17 +16,17 @@ class RedirectIfWizardCompleted
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
// Not in wizard
|
||||
if (!Str::startsWith($request->getPathInfo(), '/wizard')) {
|
||||
// Check wizard is completed or not
|
||||
if (setting('wizard.completed', 0) == 1) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
// Wizard not completed
|
||||
if (!setting('wizard.completed', 0)) {
|
||||
// Already in the wizard
|
||||
if (Str::startsWith($request->getPathInfo(), '/wizard')) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
// Wizard completed, redirect to home
|
||||
redirect()->intended('/')->send();
|
||||
// Not wizard completed, redirect to wizard
|
||||
redirect()->route('wizard.edit')->send();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user