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.

33 lines
587B

  1. <?php
  2. namespace App\Logics\QRService;
  3. use App\Codes\DepositTransferReason;
  4. class ChargeLogic
  5. {
  6. use DepositCheck;
  7. /**
  8. * デポジットをチャージする
  9. */
  10. public static function charge(
  11. string $shopId,
  12. int $amount,
  13. ) {
  14. [$shop, $deposit] = self::getData($shopId);
  15. $history = self::makeTransferHistory($shopId, $amount);
  16. $deposit->deposit += $amount;
  17. $history->transfer_reason = DepositTransferReason::チャージ;
  18. $deposit->save();
  19. $history->save();
  20. return $deposit;
  21. }
  22. }