示例#1
0
 /**
  * Sets the locale using the correct load order.
  */
 protected function setArgonLocale($locale)
 {
     Argon::setFallbackLocale($this->getFallbackLocale($locale));
     Argon::setLocale($locale);
 }
示例#2
0
文件: Model.php 项目: jBOKA/library
 /**
  * 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);
 }