- Refactored the dashboard component to include attendance, revenue, and expense summaries. - Added donut charts for order statistics by channel, payment type, marketing, and status. - Implemented a greeting message based on the current time and user information. - Updated routing to use DashboardController for the dashboard view. - Introduced a new AnalysisController for future analysis features.
51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Spatie\MediaLibrary\HasMedia;
|
|
use Spatie\MediaLibrary\InteractsWithMedia;
|
|
|
|
#[Guarded(['id'])]
|
|
class Attendance extends Model implements HasMedia
|
|
{
|
|
use HasFactory, InteractsWithMedia;
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'attendance_date' => 'date:Y-m-d',
|
|
'check_in_at' => 'datetime',
|
|
'check_out_at' => 'datetime',
|
|
'check_in_latitude' => 'decimal:7',
|
|
'check_in_longitude' => 'decimal:7',
|
|
'check_out_latitude' => 'decimal:7',
|
|
'check_out_longitude' => 'decimal:7',
|
|
'work_duration_minutes' => 'integer',
|
|
];
|
|
}
|
|
|
|
protected function formattedAttendanceDate(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
get: fn ($value) => $value ? Carbon::parse($value)->translatedFormat('l, d F Y') : null,
|
|
);
|
|
}
|
|
|
|
public function employee(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Employee::class);
|
|
}
|
|
|
|
public function payrollAdjustments(): HasMany
|
|
{
|
|
return $this->hasMany(PayrollAdjustment::class);
|
|
}
|
|
}
|