lundi 30 juillet 2018

Laravel 5.6 shared auth user info issue

I'am trying to set variable with info of authenticated user (id, name, image, e.t.c) but still have a problem with that. I've already checked about 10 examples but none of them work. At least I've tried this one approach but it doesn't work.

Use of undefined constant userinfo

So I didn't find full working example how to set variable with user info globally. Every single example is related to the old versions of Laravel or not described well or doesn't work. So I have to test every pice of code if it works. Also there is so many variants and middleware stuff (which is not described almost or terribly as you might already guess) and it is overwhelming.

It seems that I have to do something with middleware in case to use varibale globally but I suppose the problem is that not many people knows how it actually works in Laravel so that there is a large variety of methods in the internet and many of them are crutches or for old versions.

Is there simple way (that just works!) to set user info in one place and get it in any controller or blade temple?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2AqKMzG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire