Listing in laravel

0

Hello, I have following modeling: Atableworkoutsthathasseveralmodelsoftraining(models_treinos).Thetreadmillmodelhasseveralexercises.Inlaravel,Ineedtolistacertainworkout(id1,forexample),allthemodelsofthatworkoutandalltheexercisesofthatmodel.Inthecodebelow,Icanbringthedataofthetrainingandthetrainingmodels,butIcannotbringtheexercisesandtheirdata:

$trainings=TrainingHasModels::with(['models'=>function($query){$query->get()->first();}])->where('training_id',$training->id)->get();

ModelTraining

publicfunctiontrainingStudentExercises(){return$this->hasMany('App\TrainingStudentExercise','training_id');}

ModelTrainingModel

publicfunctiontrainingExercises(){return$this->hasMany('App\TrainingExercise','training_model_id');}

    
asked by anonymous 20.11.2018 / 18:26

0 answers