public function firstActivePrinciple_withRecommendations() { //$active_principles = ActivePrinciple::All(); $active_principles = ActivePrinciple::where("principio_activo", "=", "paracetamol")->orWhere("principio_activo", "=", "Ibuprofeno")->orWhere("principio_activo", "=", "Acido Acetil Salicilico")->get(); $response = array(); foreach ($active_principles as $activePrinciple) { $row = array('active_principle' => $activePrinciple->toArray(), 'recommendations' => ActivePrinciple::find($activePrinciple->id)->recommendations->toArray()); array_push($response, $row); } return Response::json($response); }