2022-12-24 22:10:40 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Illuminate\Contracts\Database\Eloquent;
|
|
|
|
|
2024-01-31 22:15:08 +08:00
|
|
|
/**
|
|
|
|
* @template TGet
|
|
|
|
* @template TSet
|
|
|
|
*/
|
2022-12-24 22:10:40 +08:00
|
|
|
interface CastsAttributes
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform the attribute from the underlying model values.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model
|
|
|
|
* @param string $key
|
|
|
|
* @param mixed $value
|
|
|
|
* @param array $attributes
|
2024-01-31 22:15:08 +08:00
|
|
|
* @return TGet|null
|
2022-12-24 22:10:40 +08:00
|
|
|
*/
|
|
|
|
public function get($model, string $key, $value, array $attributes);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Transform the attribute to its underlying model values.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model
|
|
|
|
* @param string $key
|
2024-01-31 22:15:08 +08:00
|
|
|
* @param TSet|null $value
|
2022-12-24 22:10:40 +08:00
|
|
|
* @param array $attributes
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function set($model, string $key, $value, array $attributes);
|
|
|
|
}
|