fix(attachment): memperbaiki argumen upload attachment

This commit is contained in:
Yoga Pangestu 2024-11-30 21:13:11 +07:00
parent 4fc0a06061
commit f064f4da8f
5 changed files with 11 additions and 11 deletions

View File

@ -88,7 +88,7 @@ public function update(ExpenseRequest $request, Expense $expense): RedirectRespo
} }
if (isset($validatedData['proof'])) { if (isset($validatedData['proof'])) {
$this->uploadAttachment($validatedData['proof'], 'expenses', Expense::class, $expense->id, 'expenses'); $this->uploadAttachment($validatedData['proof'], 'expenses', Expense::class, $expense->id, 'expenses');k
} }
}); });

View File

@ -106,7 +106,7 @@ public function store(AttendanceRequest $request): JsonResponse
]); ]);
} }
$this->uploadAttachment($validatedData['image'], 'attendances', Attendance::class, $newAttendance->id); $this->uploadAttachment($validatedData['image'], 'attendances', Attendance::class, $newAttendance->id, 'attendance');
}); });
return response()->json([ return response()->json([

View File

@ -36,7 +36,7 @@ public function store(InventoryRequest $request): RedirectResponse
'user_id' => Auth::id(), 'user_id' => Auth::id(),
'barbershop_id' => Auth::user()->barbershop_id, 'barbershop_id' => Auth::user()->barbershop_id,
])); ]));
$this->uploadAttachment($validatedData['image'], 'inventory', Inventory::class, $newInventory->id); $this->uploadAttachment($validatedData['image'], 'inventory', Inventory::class, $newInventory->id, 'inventory');
}); });
notify()->success('Data berhasil ditambahkan', 'Berhasil'); notify()->success('Data berhasil ditambahkan', 'Berhasil');
@ -51,7 +51,7 @@ public function update(Inventory $inventory, InventoryRequest $request): Redirec
$inventory->update($validatedData); $inventory->update($validatedData);
if (isset($validatedData['image'])) { if (isset($validatedData['image'])) {
$this->uploadAttachment($validatedData['image'], 'inventory', Inventory::class, $inventory->id); $this->uploadAttachment($validatedData['image'], 'inventory', Inventory::class, $inventory->id, 'inventory');
} }
}); });

View File

@ -36,7 +36,7 @@ public function store(BarbershopRequest $request): RedirectResponse
DB::transaction(function () use ($validatedData) { DB::transaction(function () use ($validatedData) {
$newBarbershop = Barbershop::create($validatedData); $newBarbershop = Barbershop::create($validatedData);
$this->uploadAttachment($validatedData['image'], 'barbershop', Barbershop::class, $newBarbershop->id); $this->uploadAttachment($validatedData['image'], 'barbershop', Barbershop::class, $newBarbershop->id, 'barbeshop');
}); });
notify()->success('Data berhasil ditambahkan', 'Berhasil'); notify()->success('Data berhasil ditambahkan', 'Berhasil');
@ -59,7 +59,7 @@ public function update(Barbershop $barbershop, BarbershopRequest $request): Redi
DB::transaction(function () use ($barbershop, $validatedData) { DB::transaction(function () use ($barbershop, $validatedData) {
$barbershop->update($validatedData); $barbershop->update($validatedData);
if (isset($validatedData['image'])) { if (isset($validatedData['image'])) {
$this->uploadAttachment($validatedData['image'], 'barbershop', Barbershop::class, $barbershop->id); $this->uploadAttachment($validatedData['image'], 'barbershop', Barbershop::class, $barbershop->id, 'barbershop');
} }
}); });