Files
HRM-System/app/Models/ThirteenthMonthEntry.php

50 lines
1.1 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class ThirteenthMonthEntry extends BaseModel
{
use HasFactory;
protected $fillable = [
'thirteenth_month_run_id',
'employee_id',
'user_id',
'monthly_earnings',
'total_base_earned',
'computed_amount',
'adjustment_amount',
'taxable_amount',
'non_taxable_amount',
'final_payout',
'notes',
];
protected $casts = [
'monthly_earnings' => 'array',
'total_base_earned' => 'decimal:2',
'computed_amount' => 'decimal:2',
'adjustment_amount' => 'decimal:2',
'taxable_amount' => 'decimal:2',
'non_taxable_amount' => 'decimal:2',
'final_payout' => 'decimal:2',
];
public function run()
{
return $this->belongsTo(ThirteenthMonthRun::class, 'thirteenth_month_run_id');
}
public function employee()
{
return $this->belongsTo(Employee::class, 'employee_id');
}
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
}