29 lines
No EOL
655 B
PHP
29 lines
No EOL
655 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Services\OnboardingService;
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class EnsureOnboardingComplete
|
|
{
|
|
public function __construct(
|
|
private OnboardingService $onboardingService
|
|
) {}
|
|
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* Redirect to onboarding if the user hasn't completed setup.
|
|
*/
|
|
public function handle(Request $request, Closure $next): Response
|
|
{
|
|
if ($this->onboardingService->needsOnboarding()) {
|
|
return redirect()->route('onboarding');
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
} |