= c4e2cfc4bb Feat: Modularize Keka HR integration with services
- Introduced `KekaAccessGuard`, `KekaConfigResolver`, `KekaIntegrationService`, `KekaTokenService`, and `KekaUrlBuilder` to streamline Keka HR functionality.
- Refactored `KekaController` to delegate key operations to modular services, improving maintainability.
- Updated dashboard UI to ensure alignment with the new service-based architecture.
- Enhanced error handling, logging, and code reusability for Keka integration workflows.
2026-06-12 11:55:12 +00:00

40 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Controllers;
use App\Services\Keka\{KekaAccessGuard, KekaIntegrationService};
use Illuminate\Http\{RedirectResponse, Request, Response};
class KekaController extends Controller
{
public function __construct(
private readonly KekaAccessGuard $accessGuard,
private readonly KekaIntegrationService $kekaService,
) {}
public function connect(): RedirectResponse
{
$user = $this->accessGuard->authorize();
return redirect($this->kekaService->getExternalLoginUrl($user));
}
public function callback(Request $request): Response|RedirectResponse
{
$user = $this->accessGuard->authorize();
return $this->kekaService->handleCallback($user, $request);
}
public function disconnect(): RedirectResponse
{
$user = $this->accessGuard->authorize();
$this->kekaService->disconnect($user);
return redirect()->route('dashboard.user')->with('keka_success', 'Keka HR disconnected.');
}
}