fix(attendance): memperbaiki logika save image dan menampilkan image
This commit is contained in:
parent
0dea36d1cb
commit
4715a1dfce
@ -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([
|
||||
|
||||
@ -43,9 +43,9 @@
|
||||
@if ($checkInAttendance)
|
||||
<div class="flex-shrink-0">
|
||||
<a
|
||||
href="{{ Storage::url("attendances/{$checkInAttendance->attachments->first()->formatted_attachment}") }}">
|
||||
href="{{ Storage::url("attendances/{$checkInAttendance->attachments->where('type', 'check_in')->first()->formatted_attachment}") }}">
|
||||
<img class="tab-img img-fluid"
|
||||
src="{{ Storage::url("attendances/{$checkInAttendance->attachments->first()->formatted_attachment}") }}"
|
||||
src="{{ Storage::url("attendances/{$checkInAttendance->attachments->where('type', 'check_in')->first()->formatted_attachment}") }}"
|
||||
alt="image">
|
||||
</a>
|
||||
</div>
|
||||
@ -84,9 +84,9 @@
|
||||
@if ($checkOutAttendance)
|
||||
<div class="flex-shrink-0">
|
||||
<a
|
||||
href="{{ Storage::url("attendances/{$checkOutAttendance->attachments()->latest()->first()->formatted_attachment}") }}">
|
||||
href="{{ Storage::url("attendances/{$checkOutAttendance->attachments()->where('type', 'check_out')->first()->formatted_attachment}") }}">
|
||||
<img class="tab-img img-fluid"
|
||||
src="{{ Storage::url("attendances/{$checkOutAttendance->attachments()->latest()->first()->formatted_attachment}") }}"
|
||||
src="{{ Storage::url("attendances/{$checkOutAttendance->attachments()->where('type', 'check_out')->first()->formatted_attachment}") }}"
|
||||
alt="image">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user