Auth :: id () using ajax returns null Laravel 5.5

1

It happens that I am showing a content in a datatable and making the relevant settings so that only the content of the logged in user is shown to me, so I use a method in my controller that returns the records associated to the user that is logged in.

    Por ejemplo:
    $revision = Revision::where('id', Auth::id());
    ...

It turns out that this query does not return any records if I pass it that way because it returns 'null', I thought it would not work until I passed a number to check, and if I showed the records of that user, and all this through the datatable plugin using ajax

    
asked by Luis Izquierdo 06.09.2018 в 15:27
source

1 answer

0

Try this

Auth::user()->id
    
answered by 06.09.2018 в 16:25