TIFNJK_E41222887/app/Models/Employee.php

49 lines
910 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Employee extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'nip',
'name',
'gender',
'place_of_birth',
'birth_date',
'address',
'phone_number',
'department_id',
'position_id',
'status',
'join_date'
];
// Relasi ke User
public function user()
{
return $this->belongsTo(User::class);
}
// Relasi ke Departemen
public function department()
{
return $this->belongsTo(Department::class);
}
// Relasi ke Jabatan
public function position()
{
return $this->belongsTo(Position::class);
}
public function attendances()
{
return $this->hasMany(Attendance::class);
}
}