Exemplo n.º 1
0
 /**
  * Sets the locale using the correct load order.
  */
 protected function setArgonLocale($locale)
 {
     Argon::setFallbackLocale($this->getFallbackLocale($locale));
     Argon::setLocale($locale);
 }
Exemplo n.º 2
0
 /**
  * Return a timestamp as DateTime object.
  *
  * @param  mixed  $value
  * @return \Carbon\Carbon
  */
 protected function asDateTime($value)
 {
     if ($value instanceof Argon) {
         return $value;
     }
     if ($value instanceof DateTime) {
         return Argon::instance($value);
     }
     if (is_numeric($value)) {
         return Argon::createFromTimestamp($value);
     }
     if (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2})$/', $value)) {
         return Argon::createFromFormat('Y-m-d', $value)->startOfDay();
     }
     return Argon::createFromFormat($this->getDateFormat(), $value);
 }