44 lines
846 B
PHP
44 lines
846 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
class AttendanceLocation extends BaseModel
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'created_by',
|
|
'branch_id',
|
|
'name',
|
|
'address',
|
|
'latitude',
|
|
'longitude',
|
|
'radius_meters',
|
|
'is_active',
|
|
];
|
|
|
|
protected $casts = [
|
|
'latitude' => 'float',
|
|
'longitude' => 'float',
|
|
'radius_meters' => 'integer',
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
public function branch()
|
|
{
|
|
return $this->belongsTo(Branch::class);
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function employees()
|
|
{
|
|
return $this->belongsToMany(Employee::class, 'employee_attendance_location');
|
|
}
|
|
}
|