mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
3.2.1
This commit is contained in:
20
app/Item.php
20
app/Item.php
@@ -4,6 +4,7 @@ namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use mysql_xdevapi\Collection;
|
||||
use function foo\func;
|
||||
|
||||
class Item extends Model
|
||||
{
|
||||
@@ -44,10 +45,12 @@ class Item extends Model
|
||||
return \App\ItemCategory::find($this->category_id);
|
||||
}
|
||||
|
||||
public function available()
|
||||
public function available($begin = null,$end = null)
|
||||
{
|
||||
|
||||
return $this->quantity - $this->booked();
|
||||
if ($begin == null && $end == null)
|
||||
{
|
||||
return $this->quantity - $this->booked();
|
||||
}
|
||||
}
|
||||
|
||||
public function booked()
|
||||
@@ -61,4 +64,15 @@ class Item extends Model
|
||||
|
||||
return $nbBooked;
|
||||
}
|
||||
|
||||
public static function training()
|
||||
{
|
||||
$training = collect();
|
||||
|
||||
$training = \App\Item::all()->filter(function($value,$key){
|
||||
return $value->category()->is_training == 1 && $value->category()->is_op_appro != 1;
|
||||
});
|
||||
|
||||
return $training;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user