refactor: memperbaiki fitur yang ada upload attachementnya

This commit is contained in:
Yoga Pangestu 2024-11-30 22:56:55 +07:00
parent 8d7d455a7b
commit 36408541c5
5 changed files with 13 additions and 8 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');k $this->uploadAttachment($validatedData['proof'], 'expenses', Expense::class, $expense->id, 'expenses');
} }
}); });

View File

@ -34,7 +34,7 @@ public function create(): View
{ {
return view('pages.admin.finance.payroll.create', [ return view('pages.admin.finance.payroll.create', [
'pageTitle' => 'Tambah Gaji', 'pageTitle' => 'Tambah Gaji',
'employees' => User::query()->barbershop()->latest()->get(), 'employees' => User::with('biography')->barbershop()->latest()->get(),
]); ]);
} }
@ -63,7 +63,7 @@ public function edit(Payroll $payroll): View
{ {
return view('pages.admin.finance.payroll.edit', [ return view('pages.admin.finance.payroll.edit', [
'pageTitle' => 'Edit Gaji', 'pageTitle' => 'Edit Gaji',
'employees' => User::query()->barbershop()->latest()->get(), 'employees' => User::with('biography')->barbershop()->latest()->get(),
'payroll' => $payroll, 'payroll' => $payroll,
]); ]);
} }

View File

@ -99,6 +99,11 @@ public function cash(): HasMany
return $this->hasMany(Cash::class); return $this->hasMany(Cash::class);
} }
public function debts(): HasMany
{
return $this->hasMany(Debt::class);
}
public function attachments(): MorphMany public function attachments(): MorphMany
{ {
return $this->morphMany(Attachment::class, 'attachmentable'); return $this->morphMany(Attachment::class, 'attachmentable');