46 lines
1.0 KiB
PHP
46 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Admin\Models;
|
||
|
|
||
|
use App\Traits\StatusTrait;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
use Illuminate\Notifications\Notifiable;
|
||
|
use Modules\Admin\Database\factories\ComplaintFactory;
|
||
|
use Modules\Employee\Models\Employee;
|
||
|
|
||
|
class Complaint extends Model
|
||
|
{
|
||
|
use HasFactory, Notifiable, StatusTrait;
|
||
|
|
||
|
protected $table = 'tbl_complaints';
|
||
|
protected $primaryKey = 'complaint_id';
|
||
|
|
||
|
/**
|
||
|
* The attributes that are mass assignable.
|
||
|
*/
|
||
|
protected $fillable = [
|
||
|
'complaint_id',
|
||
|
'employee_id',
|
||
|
'complaint_date',
|
||
|
'complaint_by',
|
||
|
'description',
|
||
|
'remarks',
|
||
|
'status',
|
||
|
'createdBy',
|
||
|
'updatedBy',
|
||
|
];
|
||
|
|
||
|
public $appends = ['status_name'];
|
||
|
|
||
|
public function respondent()
|
||
|
{
|
||
|
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
|
||
|
}
|
||
|
|
||
|
public function complainant()
|
||
|
{
|
||
|
return $this->belongsTo(Employee::class, 'complaint_by')->withDefault();
|
||
|
}
|
||
|
}
|