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