first commit
This commit is contained in:
40
app/Models/ServiceCatalog.php
Normal file
40
app/Models/ServiceCatalog.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?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',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user