Как я могу отправить один результат запроса (через переменную) в другой запрос - PullRequest
0 голосов
/ 26 апреля 2018

То, что я хочу, это включить результат под переменной в другой запрос.

 $sub = DB::table('chef_food_ethics')->
 select(DB::raw('count(id) as fCount'))
 ->where('chef_food_ethics.food_ethic_id',
 '=','food_ethic_managers.food_ethic_id')
 ->toSql();

Можно ли так включить?

 $r = DB::table('food_ethic_managers')where
 ('food_ethic_managers.manager_id','=',$id)
 ->leftJoin('staff','food_ethic_managers.food_ethic_id'
  ,'=','staff.id')
 ->leftJoin('regions','staff.region_id','=','regions.id')
 ->with($sub)
 ->get();
...