Illuminate\Database\Eloquent\Model::getDates PHP Method

getDates() public method

Get the attributes that should be converted to dates.
public getDates ( ) : array
return array
    public function getDates()
    {
        $defaults = [static::CREATED_AT, static::UPDATED_AT];
        return $this->timestamps ? array_merge($this->dates, $defaults) : $this->dates;
    }

Usage Example

Example #1
0
 /**
  * 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);
 }
All Usage Examples Of Illuminate\Database\Eloquent\Model::getDates
Model