DeviceTokenController.php 763 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Http\Requests\DeviceTokenRequest;
  4. use App\Services\DeviceTokenService;
  5. use Illuminate\Http\JsonResponse;
  6. use Illuminate\Support\Facades\Log;
  7. class DeviceTokenController extends Controller
  8. {
  9. public function __construct(private DeviceTokenService $deviceTokenService) {}
  10. public function store(DeviceTokenRequest $request): JsonResponse
  11. {
  12. Log::info('=== DEVICE TOKEN RECEBIDO ===', $request->validated());
  13. $this->deviceTokenService->register($request->validated());
  14. return $this->successResponse(code: 201);
  15. }
  16. public function destroy(string $token): JsonResponse
  17. {
  18. $this->deviceTokenService->remove($token);
  19. return $this->successResponse();
  20. }
  21. }