php - How to Constraining Eager Loads With whereIn function Laravel -


how pass controls function

$controls = $project['records']->pluck('id');     $domain = processdomain::with(['         process.subprocess.control' =>         function ($query,$controls) {             $query->wherein ('id', $controls);         } ])->get(); 

if using anonymous function can pass variable this:

$message = 'hello'; // inherit $message $example = function () use ($message) {     var_dump($message); }; $example(); 

in case can try:

$controls = $project['records']->pluck('id'); $domain = processdomain::with(['process.subprocess.control' => function ($query) use ($controls) {         $query->wherein ('id', $controls);     }])->get(); 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -