41 lines
846 B
PHP
41 lines
846 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Modules\HRM\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
|
||
|
|
class Loan extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'restaurant_id',
|
||
|
|
'employee_id',
|
||
|
|
'amount',
|
||
|
|
'schedule_type',
|
||
|
|
'fine_rate',
|
||
|
|
'installments',
|
||
|
|
'paid_amount',
|
||
|
|
'remaining_amount',
|
||
|
|
'status',
|
||
|
|
'loan_type',
|
||
|
|
'remarks',
|
||
|
|
'start_date',
|
||
|
|
'end_date',
|
||
|
|
];
|
||
|
|
|
||
|
|
public const TABLE_NAME = 'loans';
|
||
|
|
|
||
|
|
protected $table = self::TABLE_NAME;
|
||
|
|
|
||
|
|
public function employee(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Employee::class, 'user_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function installments(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(LoanInstallment::class);
|
||
|
|
}
|
||
|
|
}
|