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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -