lasthourcloud/app/Http/Middleware/IsBoardingFlow.php
2023-08-22 17:44:49 +02:00

29 lines
687 B
PHP

<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class IsBoardingFlow
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
$allowed_paths = [
'subscription',
'boarding',
'livewire/message/boarding'
];
if (showBoarding() && !in_array($request->path(), $allowed_paths)) {
return redirect('boarding');
}
return $next($request);
}
}