InvalidCastException.php 930 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Illuminate\Database\Eloquent;
  3. use RuntimeException;
  4. class InvalidCastException extends RuntimeException
  5. {
  6. /**
  7. * The name of the affected Eloquent model.
  8. *
  9. * @var string
  10. */
  11. public $model;
  12. /**
  13. * The name of the column.
  14. *
  15. * @var string
  16. */
  17. public $column;
  18. /**
  19. * The name of the cast type.
  20. *
  21. * @var string
  22. */
  23. public $castType;
  24. /**
  25. * Create a new exception instance.
  26. *
  27. * @param object $model
  28. * @param string $column
  29. * @param string $castType
  30. * @return void
  31. */
  32. public function __construct($model, $column, $castType)
  33. {
  34. $class = get_class($model);
  35. parent::__construct("Call to undefined cast [{$castType}] on column [{$column}] in model [{$class}].");
  36. $this->model = $class;
  37. $this->column = $column;
  38. $this->castType = $castType;
  39. }
  40. }