How to implement redirect to the page of filling out your profile at first login user?

There is an idea in the database to add a field firts_time and by default set to 1. Then when you log on to check this field and you can redirect to profile, then to change the value from 1 to 0 after the first login. But I don't know where exactly this check to make middleware or something via service providers. The forums have not found a normal solution, although the question seems to be popular. I would be grateful for a reference solution in such a situation, I'm not so good at Laravel.
March 19th 20 at 09:04
3 answers
March 19th 20 at 09:06
To create a relation type hasOne profile (if the profile is in a separate table)
public function profile()
 return $this->hasOne('App\Models\Profile','user_id', 'id');

create middelware hasProfile
there to register
if (!Auth::user()->profile) {
 return redirect()->route('profile');
return $next($request);

to add to the ranting
Route::group('middleware' => ['verified','hasProfile'], function () {

March 19th 20 at 09:08
You have a lot of ideas, show some knowledge of larval, but a little pereprodaet. What is the first avtorizacija in your case? Not filled in some required fields? And push off from the answer @Kostik_1993 Create middleware IsProfileFilled, add the check if(your field is not filled in){redirect to filling} and connect as suggested by the docks.
You're a programmer. Our task is to simplify things and not to look for complex solutions)
March 19th 20 at 09:10
protected $redirectTo = '/';

There is such a variable in the controller to register

Find more questions by tags Laravel