[Vuejs]-How to call Auth::id() in controllers for front end

0👍

Have You Tried \Auth::id(). ?
This should work I think.

0👍

These helper methods will only retrieve the authenticated user or id if an user is actively logged in and if the controller method is wrapped with the auth middleware. If not they’ll just return null.

\Auth::id();

auth()->id();

0👍

$user = auth()->user();

then

$optionElection->user_id = $user->id;

Leave a comment