DeviceTokenController.php 652 B

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