dstpabuaran.com/app/Http/Controllers/Admin/HR/AttendanceController.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

56 lines
1.6 KiB
PHP

<?php
namespace App\Http\Controllers\Admin\HR;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\HR\AttendanceRequest;
use App\Models\Attendance;
use App\Services\Admin\HR\AttendanceService;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
class AttendanceController extends Controller
{
public function __construct(
private AttendanceService $service
) {}
public function index(Request $request): Response
{
$year = $request->integer('year', now()->year);
$month = $request->integer('month', now()->month);
return Inertia::render('admin/hr/attendance/index', [
...$this->service->getIndexData($year, $month),
'highlight' => $request->input('highlight'),
]);
}
public function store(AttendanceRequest $request): RedirectResponse
{
return $this->handleAction(
fn () => $this->service->checkIn($request->validated()),
'Berhasil check-in.',
'admin.hr.attendances.index'
);
}
public function update(AttendanceRequest $request, Attendance $attendance): RedirectResponse
{
return $this->handleAction(
fn () => $this->service->checkOut($attendance, $request->validated()),
'Berhasil check-out.',
'admin.hr.attendances.index'
);
}
public function byDate(Request $request): ?array
{
$date = $request->query('date', now()->toDateString());
return $this->service->getByDate($date);
}
}