ClassMorphViolationException.php 714 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace Hyperf\Database\Exception;
  12. use RuntimeException;
  13. class ClassMorphViolationException extends RuntimeException
  14. {
  15. /**
  16. * The name of the affected Eloquent model.
  17. */
  18. public string $model;
  19. /**
  20. * Create a new exception instance.
  21. */
  22. public function __construct(object $model)
  23. {
  24. $class = get_class($model);
  25. parent::__construct("No morph map defined for model [{$class}].");
  26. $this->model = $class;
  27. }
  28. }