31 lines
696 B
PHP
31 lines
696 B
PHP
<?php
|
|
|
|
namespace App\Entities\Part;
|
|
|
|
use App\Models\Part\SOFTWAREModel;
|
|
|
|
class SOFTWAREEntity extends PartEntity
|
|
{
|
|
const PK = SOFTWAREModel::PK;
|
|
const TITLE = SOFTWAREModel::TITLE;
|
|
public function __construct(array|null $data = null)
|
|
{
|
|
$this->attributes['used'] = 0;
|
|
$this->attributes['stock'] = 0;
|
|
parent::__construct($data);
|
|
}
|
|
//기본기능
|
|
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();
|
|
}
|
|
}
|