25 lines
524 B
PHP
Raw Permalink Normal View History

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