Here's my dilemma.
I'm creating a subscription app that needs to follow the flow below:
- Create account
- Confirm email --> redirect to select a plan
- Select plan and pay with Stripe/Cashier --> redirect to /account/profile/complete
- Fill in/validate required profile info
- Set
user->status to active --> redirect to /account/dashboard
I have a middleware, UserHasActiveStatus that restricts users that aren't active:
public function handle($request, Closure $next) {
$user = $request->user();
if (auth()->user() && $user->status):
return $next($request);
endif;
flash()->error('Please complete your profile before accessing this area.');
return redirect('/account/profile/complete');
}
Now I need to find a way to add that to all account routes except account/profile/complete
My route group looks like this:
Route::group([
'prefix' => 'account',
'middleware' => ['auth', 'confirmed', 'subscribed']], function() {
// additional routes here
// Profile routes
Route::get('/profile', 'Account\ProfileController@edit');
Route::post('/profile', 'Account\ProfileController@update');
// additional routes here
});
How can I apply this middleware so this it ignores account/profile/complete ?
Thanks