mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2025-12-27 03:27:55 -05:00
40 lines
614 B
PHP
40 lines
614 B
PHP
<?php
|
|
|
|
namespace App\Models\Tokens;
|
|
|
|
use App\Models\Sale;
|
|
|
|
/**
|
|
* Token_invoice_count class
|
|
*
|
|
* @property sale sale
|
|
*
|
|
*/
|
|
class Token_invoice_count extends Token
|
|
{
|
|
/**
|
|
* @param string $value
|
|
*/
|
|
public function __construct(string $value = '')
|
|
{
|
|
parent::__construct($value);
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function token_id(): string
|
|
{
|
|
return 'CO';
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function get_value(): int
|
|
{
|
|
$sale = model(Sale::class);
|
|
return empty($value) ? $sale->get_invoice_count() : $value;
|
|
}
|
|
}
|