Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

filter child table data from parent laravel eloquent

$runs = Run::whereHas('times', function ($builder) use ($user) { 
        $query->where('user_id', $user->id);
    })->with(['times' => function ($query) use ($user) {
        $query->where('user_id', $user->id);
    }])->get();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #filter #child #table #data #parent #laravel #eloquent
ADD COMMENT
Topic
Name
7+8 =