59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\InteractsWithUuid;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class TransactionDetail extends Model
|
|
{
|
|
use HasFactory, InteractsWithUuid;
|
|
|
|
protected $table = 't_transaction_detail';
|
|
protected $primaryKey = 'id';
|
|
protected $keyType = 'string';
|
|
public $incrementing = false;
|
|
|
|
protected $fillable = [
|
|
'transaction_id',
|
|
'procedure_id',
|
|
'performed_by',
|
|
'procedure_code',
|
|
'procedure_name',
|
|
'quantity',
|
|
'unit_price',
|
|
'discount_amount',
|
|
'tax_amount',
|
|
'subtotal',
|
|
'performed_datetime',
|
|
'notes',
|
|
];
|
|
|
|
protected $casts = [
|
|
'quantity' => 'integer',
|
|
'unit_price' => 'decimal:2',
|
|
'discount_amount' => 'decimal:2',
|
|
'tax_amount' => 'decimal:2',
|
|
'subtotal' => 'decimal:2',
|
|
'performed_datetime' => 'datetime',
|
|
];
|
|
|
|
// Relationships
|
|
public function transaction(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Transaction::class, 'transaction_id');
|
|
}
|
|
|
|
public function procedure(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Procedure::class, 'procedure_id');
|
|
}
|
|
|
|
public function performer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Employee::class, 'performed_by');
|
|
}
|
|
}
|