41 lines
1007 B
PHP
41 lines
1007 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\ServiceCatalogFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
#[Fillable(['code', 'name', 'unit', 'default_price', 'sort_order', 'is_active'])]
|
|
class ServiceCatalog extends Model
|
|
{
|
|
/** @use HasFactory<ServiceCatalogFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* Get the service entries for the catalog item.
|
|
*
|
|
* @return HasMany<ServiceEntry, $this>
|
|
*/
|
|
public function serviceEntries(): HasMany
|
|
{
|
|
return $this->hasMany(ServiceEntry::class);
|
|
}
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'default_price' => 'decimal:2',
|
|
'sort_order' => 'integer',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
}
|