New-OMIS/Modules/Employee/app/Models/Employee.php

25 lines
524 B
PHP
Raw Normal View History

2024-04-07 11:54:18 +00:00
<?php
namespace Modules\Employee\Models;
2024-04-10 09:30:24 +00:00
use App\Models\User;
2024-04-07 11:54:18 +00:00
use Illuminate\Database\Eloquent\Model;
class Employee extends Model
{
protected $table = 'tbl_employees';
protected $primaryKey = 'id';
protected $guarded = [];
2024-04-16 05:09:23 +00:00
protected $appends = ['full_name'];
2024-04-11 10:52:12 +00:00
protected function getFullNameAttribute()
{
return $this->first_name . ' ' . $this->middle_name . ' ' . $this->last_name;
}
2024-04-07 11:54:18 +00:00
2024-04-10 09:30:24 +00:00
public function user()
{
return $this->belongsTo(User::class, 'users_id');
}
2024-04-07 11:54:18 +00:00
}