Add lowest price first draft.

This commit is contained in:
krzysiej committed 2025-05-13 23:34:51 +02:00
1 parent 2471a61076
commit beb717f9b9
4 files changed
+11 -5

No files matched your search

+5
View File
@@ -41,6 +41,11 @@ class Product extends Model
return $this->hasOne(Price::class)->latestOfMany('created_at');
}
public function lowestPrice(): HasOne
{
return $this->hasOne(Price::class)->ofMany('price', 'MIN');
}
public function stock(): HasMany
{
return $this->hasMany(Stock::class);