diff --git a/app/Http/Controllers/Admin/Manage/AttendanceController.php b/app/Http/Controllers/Admin/Manage/AttendanceController.php index 65cf5c9..930e621 100644 --- a/app/Http/Controllers/Admin/Manage/AttendanceController.php +++ b/app/Http/Controllers/Admin/Manage/AttendanceController.php @@ -105,8 +105,7 @@ public function store(AttendanceRequest $request): JsonResponse 'check_out' => now(), ]); } - - $this->uploadAttachment($validatedData['image'], 'attendances', Attendance::class, $newAttendance->id, 'attendance'); + $this->uploadAttachment($validatedData['image'], 'attendances', Attendance::class, $newAttendance->id, ! $checkInAttendance ? 'check_in' : 'check_out'); }); return response()->json([ diff --git a/resources/views/pages/admin/manage/attendances.blade.php b/resources/views/pages/admin/manage/attendances.blade.php index 2d39c9e..cf8af9e 100644 --- a/resources/views/pages/admin/manage/attendances.blade.php +++ b/resources/views/pages/admin/manage/attendances.blade.php @@ -43,9 +43,9 @@ @if ($checkInAttendance)
attachments->first()->formatted_attachment}") }}"> + href="{{ Storage::url("attendances/{$checkInAttendance->attachments->where('type', 'check_in')->first()->formatted_attachment}") }}"> attachments->first()->formatted_attachment}") }}" + src="{{ Storage::url("attendances/{$checkInAttendance->attachments->where('type', 'check_in')->first()->formatted_attachment}") }}" alt="image">
@@ -84,9 +84,9 @@ @if ($checkOutAttendance)
attachments()->latest()->first()->formatted_attachment}") }}"> + href="{{ Storage::url("attendances/{$checkOutAttendance->attachments()->where('type', 'check_out')->first()->formatted_attachment}") }}"> attachments()->latest()->first()->formatted_attachment}") }}" + src="{{ Storage::url("attendances/{$checkOutAttendance->attachments()->where('type', 'check_out')->first()->formatted_attachment}") }}" alt="image">