P
P
Programmir2017-03-27 18:50:02
Laravel
Programmir, 2017-03-27 18:50:02

Authentication not working in laravel 5.4?

registered in registercontroller

$user=User::create([
                      ...
    ]);
    Auth::login($user);
    $myid = Auth::id();
    return redirect()->route('profile',['id'=>$myid]),

Accordingly, I am redirecting to a page with a new id.
in the web I have written
Route::get('/profile/{id}','[email protected]')->name('profile');

In the ProfileControlle in the show method, I write dump(Auth::user()), but it shows null
. I tried with sessions, but they are not saved either, also null
. What could be the problem?
I tried dragging lines back and forth in Kernel.php, but it didn't help.
I already registered the web middleware paths, although laravel automatically uses this intermediary. As expected, it didn't work either. What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shamsudin Serderov, 2017-03-27
@Steein

$this->guard()->login($user);
       return redirect($this->redirectPath());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question