/**
* Format the value of a model attribute.
*
* Looks for $this->formatColumnName() methods.
*
* Note that the model's date/time attributes are automatically passed
* through $this->__carbon().
*
* @param string $name
* @param array $args
* @return mixed
*/
public function __call($name, array $args = [])
{
$method = 'format' . studly_case($name);
if (method_exists($this, $method)) {
return $this->{$method}();
}
$name = snake_case($name);
if (in_array($name, $this->model->getDates())) {
return $this->__carbon($name, data_get($args, 0), data_get($args, 1));
}
return data_get($this->model, $name);
}