Closed packytagliaferro closed 7 years ago
Raised here also: https://github.com/nahid/talk/issues/54
public function __construct()
{
$this->middleware('auth');
$this->middleware(function ($request, $next) {
$id = Auth::user()->id;
Talk::setAuthUserId($id);
return $next($request);
});
This seems to have worked for me (MessageController), found it on laracasts somewhere I think.
see the update documentation. You have to register Talk
middleware and call it from controller constructor
function __construct()
{
$this->middleware('talk');
}
So I set up my MessageController.php like so:
If I try and
dd( Talk::setAuthUserId( Auth::user() ) )
it returnsfalse
so the user is not being set. But if I hardcode an id in my construct like:The user is set and I can get
$inboxes = Talk::getInbox();
I know
Auth::id()
will return my user id of 2 so not sure what is going on