first commit
This commit is contained in:
46
Modules/Admin/app/Models/PromotionDemotion.php
Normal file
46
Modules/Admin/app/Models/PromotionDemotion.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use App\Observers\PromotionDemotionObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Employee\Models\Employee;
|
||||
|
||||
#[ObservedBy([PromotionDemotionObserver::class])]
|
||||
class PromotionDemotion extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "tbl_promotion_demotions";
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'employee_id',
|
||||
'title',
|
||||
'type',
|
||||
'old_designation_id',
|
||||
'new_designation_id',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
];
|
||||
|
||||
public function employee()
|
||||
{
|
||||
return $this->belongsTo(Employee::class, 'employee_id');
|
||||
}
|
||||
|
||||
public function oldDesignation()
|
||||
{
|
||||
return $this->belongsTo(Designation::class, 'old_designation_id')->withDefault(['name' => '-']);
|
||||
}
|
||||
|
||||
public function newDesignation()
|
||||
{
|
||||
return $this->belongsTo(Designation::class, 'new_designation_id')->withDefault(['name' => '-']);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user