复杂多对多Laravel 4

I have to do the following relationship: enter image description here

any idea how to implement this relationship with the Eloquent laravel?

I'm having trouble implementing the relationship between "drug", "prescription" and "hour"

For the relationship "prescription_drug_has_hour" you have n-ary relationship, exactly 3 tables, you can do this like you do for a normal ManyToMany :

relations on Prescription:
belongsToMany('Drug','prescription_drug_has_hour')->withPivot('hour_id');
belongsToMany('Hour','prescription_drug_has_hour')->withPivot('drug_id');
// and so on

For the "drug" has active principle it's just a normal ManyToMany (without the withPivot)

note that if you want to make more attributes available when you have a relationship that carries attribues you can add them to the withPivot function like so :

// prescription_has_drug
// ...
// relation on Prescription:
belongsToMany('Drug','prescription_has_drug')->withPivot('via_id', 'method_id', 'miligram', 'observation');