dstpabuaran.com/app/Http/Controllers/Admin/Finance/ExpenseController.php
Yoga Pangestu 22c9a4cf2a feat: add notification highlight feature to various services and frontend components
- Updated paginated methods in multiple services to accept a highlight parameter for filtering results.
- Modified notification URLs to include the highlight parameter for specific entity IDs.
- Enhanced frontend components to display a message when filtered by notification, with an option to show all entries.
- Implemented mark as read functionality in the notification bell component upon clicking a notification.
- Updated multiple index pages to handle the highlight prop and display relevant messages.
2026-08-15 00:11:40 +07:00

55 lines
1.6 KiB
PHP

<?php
namespace App\Http\Controllers\Admin\Finance;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\Finance\ExpenseRequest;
use App\Http\Requests\PaginatedRequest;
use App\Models\Expense;
use App\Services\Admin\Finance\ExpenseService;
use Illuminate\Http\RedirectResponse;
use Inertia\Inertia;
use Inertia\Response;
class ExpenseController extends Controller
{
public function __construct(
private ExpenseService $service
) {}
public function index(PaginatedRequest $request): Response
{
return Inertia::render('admin/finance/expense/index', [
'expenses' => $this->service->paginated(...$request->validatedWithDefaults()),
'highlight' => $request->input('highlight'),
]);
}
public function store(ExpenseRequest $request): RedirectResponse
{
return $this->handleAction(
fn () => $this->service->store($request->validated()),
'Pengeluaran berhasil ditambahkan.',
'admin.finance.expenses.index'
);
}
public function update(ExpenseRequest $request, Expense $expense): RedirectResponse
{
return $this->handleAction(
fn () => $this->service->update($expense, $request->validated()),
'Pengeluaran berhasil diperbarui.',
'admin.finance.expenses.index'
);
}
public function destroy(Expense $expense): RedirectResponse
{
return $this->handleAction(
fn () => $this->service->destroy($expense),
'Pengeluaran berhasil dihapus.',
'admin.finance.expenses.index'
);
}
}