領収証発行サービス
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.

28 satır
689B

  1. <?php
  2. namespace App\Models\Feature;
  3. use App\Models\ColumnName;
  4. use App\Models\SMSSendOrder;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  7. use LogicException;
  8. trait SMSSendOrderFeature
  9. {
  10. public function setSMSSendOrder(SMSSendOrder|string $smsSendOrder)
  11. {
  12. $id = is_string($smsSendOrder) ? $smsSendOrder : $smsSendOrder->id;
  13. data_set($this, ColumnName::SMS_SEND_ORDER_ID, $id);
  14. }
  15. public function smsSendOrder(): BelongsTo
  16. {
  17. if ($this instanceof Model) {
  18. return $this->belongsTo(SMSSendOrder::class);
  19. } else {
  20. throw new LogicException("不正");
  21. }
  22. }
  23. }