Is it possible to do a query inside a scope function in Laravel, What am trying to do is get the total sum of available products in a model and compare it with the defined restocking level in another model.
This is what I have so far and its not working
public function scopeDuereorders($query)
{
return $query->with(["centerdesc"])->where('reorderLevel',"<",Stockdetails::where('partNumb', $this->partcode)->sum('quantity'))->orderBy("partDesc", "ASC")->get();
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2sp4CUB
via IFTTT
Aucun commentaire:
Enregistrer un commentaire