Exemplo n.º 1
0
 /**
  * Set a given attribute on the model.
  *
  * @param  string  $key
  * @param  mixed   $value
  * @return void
  */
 public function setAttribute($key, $value)
 {
     if (in_array($key, $this->getDates()) && $value) {
         if (!$value instanceof Carbon && !$value instanceof DateTime) {
             $value = new Carbon($value);
             $this->attributes[$key] = $value;
             return;
         }
     }
     parent::setAttribute($key, $value);
 }