title: How to get current user id in constructor in laravel?
body: <p>I am using laravel 5.7, but i can't get current user id in __construct().</p>
  
  <p>I also tried Auth:id(), but it also not working. </p>
  
  <p>How to get current user id in constructor?</p>
  
  <pre><code>use Illuminate\Support\Facades\Auth;
  
  class TestController extends Controller
  {
  
      public $id;
  
      public function __construct()
      {
          $this-&gt;middleware('auth');
          $this-&gt;middleware(function ($request, $next) {
              $this-&gt;id = Auth::user()-&gt;id;
              return $next($request);
          });
          dd($this-&gt;id);
      }
  }
  </code></pre>
  
  <p>Current output is null.</p>