class TestCast implements CastsAttributes
{
public function get($model, string $key, $value, array $attributes)
{
return new Product();
}
public function set($model, string $key, $value, array $attributes)
{
dd('Run');
}
}
$product = Product::query()->first();
dd($product->price, $product->price);
protected $casts = [
'price' => TestCast::class,
];