/
home
/
techb158
/
immovalet.com
/
platform
/
core
/
base
/
src
/
Traits
/
/home/techb158/immovalet.com/platform/core/base/src/Traits
mkdir
upload
Name
Size
Mode
Actions
EnumCastable.php
824
0644
edit
dl
rm
HasDeleteManyItemsTrait.php
1241
0644
edit
dl
rm
LoadAndPublishDataTrait.php
5913
0644
edit
dl
rm
Edit:
/home/techb158/immovalet.com/platform/core/base/src/Traits/EnumCastable.php
(824B)
<?php namespace Botble\Base\Traits; use Botble\Base\Supports\Enum; trait EnumCastable { /** * @param string $key * @param mixed $value * @return mixed */ protected function castAttribute($key, $value) { $castedValue = parent::castAttribute($key, $value); if ($castedValue === $value && !is_object($value)) { $castType = $this->getCasts()[$key]; if (class_exists($castType) and is_subclass_of($castType, Enum::class)) { $castedValue = new $castType($value); } } return $castedValue; } /** * Determine if the given key is cast using a custom class. * * @param string $key * @return bool */ protected function isClassCastable($key) { return false; } }
Save
cmd:
run