Skip to content

How to load only my own records (user_id filter) #1245

Answered by lrljoe
iamgoodbytes asked this question in Q&A
Discussion options

You must be logged in to vote

Make sure to include builder in the top of your component.

use Illuminate\Database\Eloquent\Builder;

Don't typehint it or try to add any variables into the class instantiation

It should resemble

    public function builder(): Builder
    {
        return User::query()
            // Your criteria here
    }

Replies: 3 comments 2 replies

Comment options

lrljoe
Jun 9, 2023
Collaborator Sponsor

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@lrljoe
Comment options

lrljoe Jun 9, 2023
Collaborator Sponsor

Answer selected by iamgoodbytes
Comment options

You must be logged in to vote
1 reply
@lrljoe
Comment options

lrljoe Jun 9, 2023
Collaborator Sponsor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants