Closed rishabgarg closed 7 years ago
i have added this to my middleware for loggedin users.
From laravel 5.3 controller constructor execute before run middleware, so you can not access authenticated users info from controller constructor, check https://laracasts.com/discuss/channels/laravel/cant-call-authuser-on-controllers-constructor.
So the solution is, you can make a middleware and write this code in handle
section
if (Auth::check()) {
Talk::setAuthUserId(Auth::user()->id)
}
return $next($request);
and register this middleware in Kernel.php
middleware
array. I think this problem will solved.
Thank you
I'm using Laravel 5.4 and realized that Talk::setAuthUserId(Auth::user()->id), doesn't work in constructor anymore. I have to call Talk::setAuthUserId in all the methods (chatHistory, ajaxSendMessage, ajaxDeleteMessage) explicitly.
Is there a fix for this in the latest version of Talk.