2023-08-22 15:44:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
2023-09-15 09:19:36 +00:00
|
|
|
use Illuminate\Support\Str;
|
2023-08-22 15:44:49 +00:00
|
|
|
|
|
|
|
class IsBoardingFlow
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
|
|
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
|
|
|
*/
|
|
|
|
public function handle(Request $request, Closure $next): Response
|
|
|
|
{
|
2023-09-11 13:53:05 +00:00
|
|
|
// ray()->showQueries()->color('orange');
|
2023-08-24 15:41:11 +00:00
|
|
|
if (showBoarding() && !in_array($request->path(), allowedPathsForBoardingAccounts())) {
|
2023-09-15 09:19:36 +00:00
|
|
|
if (Str::startsWith($request->path(), 'invitations')) {
|
|
|
|
return $next($request);
|
|
|
|
}
|
2023-08-22 15:44:49 +00:00
|
|
|
return redirect('boarding');
|
|
|
|
}
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|