Why does not remembering user of Laravel?

Hello. Doing a little study project on Laravel. Had to do custom authentication (token-based, not username / password).
Sent a small test code:
 echo('Login OK');



Route::get('/logout',function (){

The User Model

namespace App;

use Illuminate\Notifications\is a notifiable;

use Illuminate\Foundation\Auth\Authenticatable as User;

class User extends Authenticatable
 the use is a notifiable;

 protected $user_id;
 protected $f_name;
 protected $l_name;
 protected $auth_token;

<br / >
<br / > When you click on /login - it says Login Ok, no errors, but when moving /check_u returns null. <br / > I.e. the user is not authenticated just for unknown reasons. <br / > But what is most interesting - if you remove the line <code class="php">echo('Login OK');</code>then everything is fine, when switching to check_u - is instance of User. Searched whole Google, but the solution was never found. I hope for your help.<br><br><div class="spoiler"><b class="spoiler_title">the table the user has</b><div class="spoiler_text"><img src="https://habrastorage.org/webt/59/d3/fc/59d3fc36c42fc637132296.png" alt="59d3fc36c42fc637132296.png"></div></div>
June 14th 19 at 20:09
1 answer
June 14th 19 at 20:11
if you remove the line echo('Login OK');then everything is fine

And when you return echo, I bet you get an error headers already sent.

And documentation of the sessions you have not watched.
To use sessions based on a cookie, the function session_start() must be called before you output anything to the browser.

Find more questions by tags LaravelPHPProgramming