for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SimpleCMS\Region\Casts;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
class Polygon implements CastsAttributes
{
/**
* Transform the attribute from the underlying model values.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $key
* @param mixed $value
* @param array<string, mixed> $attributes
* @return mixed
*/
public function get($model, $key, $value, $attributes)
return json_decode($value, true);
}
* Transform the attribute to its underlying model values.
public function set($model, $key, $value, $attributes)
return json_encode($value);