mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
Add ItemCategory form
This commit is contained in:
18
app/Item.php
18
app/Item.php
@@ -31,4 +31,22 @@ class Item extends Model
|
||||
{
|
||||
return \App\ItemCategory::find($this->category_id);
|
||||
}
|
||||
|
||||
public function available()
|
||||
{
|
||||
|
||||
return $this->quantity - $this->booked();
|
||||
}
|
||||
|
||||
public function booked()
|
||||
{
|
||||
$nbBooked = 0;
|
||||
|
||||
foreach ($this->bookings() as $b)
|
||||
{
|
||||
$nbBooked = $nbBooked + $b->amount;
|
||||
}
|
||||
|
||||
return $nbBooked;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user