57 lines
1.3 KiB
PHP
57 lines
1.3 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Admin\Models;
|
||
|
|
||
|
use App\Observers\WarningObserver;
|
||
|
use App\Traits\StatusTrait;
|
||
|
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
use Modules\Employee\Models\Employee;
|
||
|
|
||
|
#[ObservedBy([WarningObserver::class])]
|
||
|
class Warning extends Model
|
||
|
{
|
||
|
use HasFactory, StatusTrait;
|
||
|
|
||
|
protected $table = 'tbl_warnings';
|
||
|
protected $primaryKey = 'warning_id';
|
||
|
/**
|
||
|
* The attributes that are mass assignable.
|
||
|
*/
|
||
|
protected $fillable = [
|
||
|
'employee_id',
|
||
|
'type',
|
||
|
'reason',
|
||
|
'warning_date',
|
||
|
'description',
|
||
|
'remarks',
|
||
|
'status',
|
||
|
'createdBy',
|
||
|
'updatedBy',
|
||
|
];
|
||
|
|
||
|
public $appends = ['status_name'];
|
||
|
|
||
|
public const WARNING_TYPE = [
|
||
|
1 => 'Verbal Warning',
|
||
|
2 => 'Written Warning',
|
||
|
3 => 'Suspension',
|
||
|
4 => 'Termination Notice',
|
||
|
];
|
||
|
|
||
|
public const WARNING_REASON = [
|
||
|
1 => 'Performance Issues',
|
||
|
2 => 'Attendance Problems',
|
||
|
3 => 'Policy Violations',
|
||
|
4 => 'Customer Complaints',
|
||
|
5 => 'Interpersonal Issues',
|
||
|
6 => 'Behavioral Concerns',
|
||
|
];
|
||
|
|
||
|
public function warningRecipient()
|
||
|
{
|
||
|
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
|
||
|
}
|
||
|
}
|