25 lines
524 B
PHP
25 lines
524 B
PHP
<?php
|
|
|
|
namespace Modules\Employee\Models;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Employee extends Model
|
|
{
|
|
protected $table = 'tbl_employees';
|
|
protected $primaryKey = 'id';
|
|
protected $guarded = [];
|
|
protected $appends = ['full_name'];
|
|
|
|
protected function getFullNameAttribute()
|
|
{
|
|
return $this->first_name . ' ' . $this->middle_name . ' ' . $this->last_name;
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'users_id');
|
|
}
|
|
}
|