I have a DB statement,
return DB::select('select *, SUM(`unrestrict`), SUM(`quarantine`) from n.stock_levels_crm GROUP BY `mat_no` ORDER BY `mat_no` ASC');
How can I load relations on top of this, as a model. (the model is called "Stock_Levels"
I think the right way to do it is
return Stock_Levels_CRM::with('materialDescription')->select(DB::raw('*, SUM(`unrestrict`), SUM(`quarantine`)')->groupBy('mat_no')->get();
But if I do it this way the whole thing just crashes and times out
Thank you
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire