You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.0KB

  1. <?php
  2. namespace App\Http\Controllers\Web\QRService\Acquisition;
  3. use App\Http\Controllers\Web\WebController;
  4. use App\Models\HtpmsCustomer\QRService\AcquisitionTicketToken;
  5. use Illuminate\Http\JsonResponse;
  6. use Illuminate\Http\Request;
  7. use Str;
  8. class RefreshAcquisitionTokenController extends WebController
  9. {
  10. public function name(): string
  11. {
  12. return "サービス券取得用トークンリフレッシュ";
  13. }
  14. public function description(): string
  15. {
  16. return "サービス券取得用トークンをリフレッシュする";
  17. }
  18. public function __construct(protected RefreshGetAcquisitionTokenParam $param)
  19. {
  20. parent::__construct();
  21. }
  22. protected function run(Request $request): JsonResponse
  23. {
  24. $shopId = $this->sessionUser->shopId();
  25. $token = AcquisitionTicketToken::whereShopId($shopId)->firstOrNew();
  26. $token->shop_id = $shopId;
  27. $token->token = Str::uuid()->toString();
  28. $token->save();
  29. return $this->successResponse();
  30. }
  31. }