I have 2 models 'Seller' & 'Price'. The price model is for a historical table which tracks prices. I'd like to display those in a chart and so I need to group the 'prices' relationship on created at date (on hour level).
@MohamedTammam Thanks for your reply, but this just selects the colums? I need to group them together on the price model + I need it for a list of Sellers not just 1 model instance.
public function prices()
{
return $this->hasMany(Price::class);
}
public function product()
{
return $this->belongsTo(Product::class);
}
public function seller()
{
return $this->belongsTo(Seller::class);
}