mercredi 29 mars 2017

How to build a particular query in laravel 5.4 using eloquent model

I have one mysql query which is working but i want to use it using laravel eloquent model. I have model name "Drug","Organism","Organismdruglink". I am unable to build this query on controller. Can anyone help me converting this query according to laravel eloquent. Here is my query:

SELECT drugs.*,count_table.count_organism FROM drugs Inner join ( SELECT drug_id,count(organism_id) as count_organism FROM organismdruglinks GROUP by drug_id) count_table ON drugs.id = count_table.drug_id 



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire