您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

36 行
777B

  1. <?php
  2. namespace App\Logics\Shop;
  3. use App\Exceptions\ParamException;
  4. use App\Models\HtpmsCustomer\Deposit\Deposit;
  5. use App\Models\HtpmsCustomer\Mst\Shop;
  6. use App\Models\User;
  7. class ShopLogic
  8. {
  9. private User|null $customerUser = null;
  10. private Shop|null $shop = null;
  11. public function create(User $customerUser, Shop $shop)
  12. {
  13. $this->customerUser = $customerUser;
  14. $this->shop = $shop;
  15. // チェック処理
  16. if (Shop::whereName($shop->name)->exists()) {
  17. ParamException::throw(Shop::COL_NAME_NAME, trans('validation.unique'));
  18. }
  19. $shop->save();
  20. // デポジット
  21. $deposit = new Deposit();
  22. $deposit->shop_id = $shop->id;
  23. $deposit->save();
  24. return $shop;
  25. }
  26. }