12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Models;
- # use Illuminate\Database\Eloquent\Model;
- class HrSectionChange extends Model
- {
- protected $table = 'hr_section_change';
- public function hrSection()
- {
- return $this->hasOne(HrSection::class, 'id', 'hr_section_id');
- }
- public function getOldValue(){
- switch($this->change_type){
- case 'DATA': return $this->old_data;
- case 'STATUS': return $this->old_status;
- case 'PROPOSED_DATA': return $this->old_proposed_data;
- case 'PROPOSED_STATUS': return $this->old_proposed_status;
- default:
- return 'Unknown change type';
- }
- }
- public function getNewValue(){
- switch($this->change_type){
- case 'DATA': return $this->new_data;
- case 'STATUS': return $this->new_status;
- case 'PROPOSED_DATA': return $this->new_proposed_data;
- case 'PROPOSED_STATUS': return $this->new_proposed_status;
- default:
- return 'Unknown change type';
- }
- }
- }
|