Open
Description
In src/Helper.php
, why would I cast a useful object to an array and lose all the functionality they provide?
For example:
I have a scheduled_at
column, which should be rendered as d-m-Y H:i
, and I can't use ->format()
on it because it has been cast to an array from a Carbon\Carbon
object.
/**
* Cast the parameter into an array.
*
* @param mixed $param
* @return array
*/
public static function castToArray($param)
{
if ($param instanceof \stdClass) {
$param = (array) $param;
return $param;
}
if ($param instanceof Arrayable) {
return $param->toArray();
}
return $param;
}