Such a call displays all fields from the combined tables.
$model = Model::with('table1', 'table2') ->whereHas('table1',function($t)use($fackt){ $t->where('name','LIKE','%'.$fackt.'%'); }) ->get() On large tables, the output of all fields is not the fastest solution, how to display only the fields I need? Tried to use this type of request, but it does not work correctly.
$model = Model::select('col1', 'col2')->with('table1', 'table2') ->whereHas('table1',function($t)use($fackt){ $t->where('name','LIKE','%'.$fackt.'%'); }) ->get()