StocksNew/Modules/Admin/app/Models/Resignation.php
Sampanna Rimal 53c0140f58 first commit
2024-08-27 17:48:06 +05:45

60 lines
1.3 KiB
PHP

<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\ResignationFactory;
use Modules\Employee\Models\Employee;
class Resignation extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_resignations';
protected $primaryKey = 'resignation_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'employee_id',
'resignation_date',
'resignation_type',
'progress_status_id',
'approved_date',
'approved_by',
'description',
'remarks',
'status',
'createdBy',
'updatedBy',
];
public $appends = ['status_name'];
public const RESIGNATION_TYPE = [
1 =>'Voluntary',
2=> 'Involuntary',
3=> 'Retirement',
];
public const PROGRESS_STATUS = [
1 => 'Pending',
2 => 'Approved',
3 => 'Rejected',
];
public function resigner()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
public function approver()
{
return $this->belongsTo(Employee::class, 'approved_by')->withDefault();
}
}