43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Catalog\Infrastructure\Persistence\Eloquent;
|
|
|
|
use Database\Factories\ServiceUnitFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Attributes\Table;
|
|
use Illuminate\Database\Eloquent\Attributes\UseFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Persistence model, used only inside the Catalog Infrastructure layer.
|
|
*
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property bool $is_shared
|
|
* @property bool $uses_stock
|
|
* @property bool $is_active
|
|
* @property int $sort_order
|
|
*/
|
|
#[Table('service_units')]
|
|
#[Fillable(['name', 'is_shared', 'uses_stock', 'is_active', 'sort_order'])]
|
|
#[UseFactory(ServiceUnitFactory::class)]
|
|
class ServiceUnitModel extends Model
|
|
{
|
|
/** @use HasFactory<ServiceUnitFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'is_shared' => 'boolean',
|
|
'uses_stock' => 'boolean',
|
|
'is_active' => 'boolean',
|
|
'sort_order' => 'integer',
|
|
];
|
|
}
|
|
}
|