Morning,
il would like to use Eloquent to make this request but i have an error.
$ModelVars=Model1::with(['Model2' => function($query,$var){
return $query->where('field1', 'like', '%'.$var.'%');}])->get();
Could somebody help me. Thks in advance.