Add indexes to the database.
This commit was merged in pull request #60.
This commit is contained in:
@@ -63,7 +63,7 @@ class Product extends Model
|
||||
|
||||
public function newestPrice(): HasOne
|
||||
{
|
||||
return $this->hasOne(Price::class)->latest();
|
||||
return $this->hasOne(Price::class)->latest()->take(1);
|
||||
}
|
||||
|
||||
public function stock(): HasMany
|
||||
@@ -73,7 +73,7 @@ class Product extends Model
|
||||
|
||||
public function currentStock(): HasOne
|
||||
{
|
||||
return $this->stock()->one()->ofMany()->withDefault(fn(Stock $stock) => $stock->stock = 0);
|
||||
return $this->stock()->one()->ofMany()->withDefault(fn(Stock $stock) => $stock->stock = 0)->take(1);
|
||||
}
|
||||
|
||||
public function toggleStarred(): self
|
||||
|
||||
Reference in New Issue
Block a user