spqr/vendor/illuminate/database/Eloquent/InvalidCastException.php

49 lines
932 B
PHP
Raw Normal View History

2024-11-05 12:10:06 +08:00
<?php
namespace Illuminate\Database\Eloquent;
use RuntimeException;
class InvalidCastException extends RuntimeException
{
/**
* The name of the affected Eloquent model.
*
* @var string
*/
public $model;
/**
* The name of the column.
*
* @var string
*/
public $column;
/**
* The name of the cast type.
*
* @var string
*/
public $castType;
/**
* Create a new exception instance.
*
* @param object $model
* @param string $column
* @param string $castType
* @return static
*/
public function __construct($model, $column, $castType)
{
$class = get_class($model);
parent::__construct("Call to undefined cast [{$castType}] on column [{$column}] in model [{$class}].");
$this->model = $class;
$this->column = $column;
$this->castType = $castType;
}
}