Skip to content
Advertisement

How can I modify my Controller so that the query is limited to the user id?

I have my Controller set up as such:

JavaScript

Here I can pass everything from my DB into my view, but how can I filter these out such that only entries from a certain user_id is displayed? This is what my table looks like: https://imgur.com/AUZhA1L.

I have attempted to use the {user} blade but am stuck.

Advertisement

Answer

Change this line:

JavaScript

to this:

JavaScript

Or if you want to get the logged in user, you can use Auth.

Add this line after use AppModelsBooking;

JavaScript

and then:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement