40 lines
873 B
PHP
40 lines
873 B
PHP
<?php
|
|
|
|
namespace App\Entities\Equipment;
|
|
|
|
use App\Models\Equipment\CHASSISModel;
|
|
|
|
class CHASSISEntity extends EquipmentEntity
|
|
{
|
|
const PK = CHASSISModel::PK;
|
|
const TITLE = CHASSISModel::TITLE;
|
|
protected $attributes = [
|
|
'title' => '',
|
|
'price' => 0,
|
|
'used' => 0,
|
|
'stock' => 0,
|
|
'status' => '',
|
|
];
|
|
public function __construct(array|null $data = null)
|
|
{
|
|
parent::__construct($data);
|
|
}
|
|
//기본기능
|
|
public function getPrice(): int
|
|
{
|
|
return $this->attributes['price'] ?? 0;
|
|
}
|
|
public function getStock(): int
|
|
{
|
|
return $this->attributes['stock'] ?? 0;
|
|
}
|
|
public function getUsed(): int
|
|
{
|
|
return $this->attributes['used'] ?? 0;
|
|
}
|
|
public function getAvailable(): int
|
|
{
|
|
return $this->getStock() - $this->getUsed();
|
|
}
|
|
}
|