This commit is contained in:
mobin
2025-07-10 18:23:56 +00:00
commit a43f302265
383 changed files with 55982 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Attendance extends Model
{
protected $fillable = [
'user_id',
'user_identity',
'latitude',
'longitude',
'latitude_exit',
'longitude_exit',
'ip_exit',
'latitude_office',
'longitude_office',
'distance',
'ip_address',
'entered_at',
'exited_at',
];
public function setEntryLocationAttribute($value)
{
$this->attributes['entry_location'] = DB::raw("ST_SetSRID(ST_Point({$value['lng']}, {$value['lat']}), 4326)");
}
public function setExitLocationAttribute($value)
{
$this->attributes['exit_location'] = DB::raw("ST_SetSRID(ST_Point({$value['lng']}, {$value['lat']}), 4326)");
}
public function setOfficeLocationAttribute($value)
{
$this->attributes['office_location'] = DB::raw("ST_SetSRID(ST_Point({$value['lng']}, {$value['lat']}), 4326)");
}
public function breaks()
{
return $this->hasMany(AttendanceBreak::class);
}
public $timestamps = true;
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AttendanceBreak extends Model
{
protected $fillable = [
'attendance_id',
'break_start',
'break_end',
];
// رابطه به حضور
public function attendance()
{
return $this->belongsTo(Attendance::class);
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ai extends Model
{
//
}