Answer the question
In order to leave comments, you need to log in
How to implement a redirect to the profile filling page during the first user authorization?
There is an idea in the database to add the firts_time field and set it to 1 by default. Then, at the entrance, check this field and redirect to fill out the profile, then change the value from 1 to 0 after the first authorization. But I don’t understand where exactly to organize this check, in middleware or somehow through service providers. I did not find a normal solution on the forums, although the question seems to be popular. I would be grateful for a template solution in such a situation, I am not so strong in Laravel yet.
Answer the question
In order to leave comments, you need to log in
Create relation profile hasOne type (if the profile is in a separate table)
public function profile()
{
return $this->hasOne('App\Models\Profile','user_id', 'id');
}
if (!Auth::user()->profile) {
return redirect()->route('profile');
}
return $next($request);
Route::group('middleware' => ['verified','hasProfile'], function () {
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question