migrate to gtea from bistbucket
This commit is contained in:
46
public/restaurant/Modules/HRM/app/Models/Attendance.php
Normal file
46
public/restaurant/Modules/HRM/app/Models/Attendance.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\HRM\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
class Attendance extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'employee_id',
|
||||
'date',
|
||||
'first_clock_in',
|
||||
'last_clock_out',
|
||||
'hours_worked',
|
||||
'status',
|
||||
'breaks',
|
||||
'notes',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'breaks' => 'array',
|
||||
'notes' => 'array',
|
||||
'date' => 'date',
|
||||
'first_clock_in' => 'datetime:H:i:s',
|
||||
'last_clock_out' => 'datetime:H:i:s',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'attendances';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function employee(): HasOne
|
||||
{
|
||||
return $this->hasOne(Employee::class, 'id', 'employee_id')
|
||||
->select('id', 'first_name', 'last_name', 'department_id', 'designation_id')
|
||||
->with('department', 'designation');
|
||||
}
|
||||
|
||||
public function logs(): HasMany
|
||||
{
|
||||
return $this->hasMany(AttendanceLog::class, 'attendance_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user