ClientCalendarController.php 689 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Services\ClientCalendarService;
  4. use Illuminate\Http\JsonResponse;
  5. use Illuminate\Support\Facades\Log;
  6. class ClientCalendarController extends Controller
  7. {
  8. public function __construct(private readonly ClientCalendarService $service) {}
  9. public function index(): JsonResponse
  10. {
  11. try {
  12. $dados = $this->service->getCalendar();
  13. return $this->successResponse(payload: $dados);
  14. } catch (\Exception $e) {
  15. Log::error('Error fetching client calendar: '.$e->getMessage());
  16. return $this->errorResponse(message: __('messages.error_fetching_data'), code: 500);
  17. }
  18. }
  19. }