Ejemplo n.º 1
0
 /**
  * Detect environment
  *
  * By default check
  *
  * @return string env
  */
 public static function detectEnvironment($request = null)
 {
     if (!empty(static::$env)) {
         return static::$env;
     }
     $rules = self::get('env');
     $request = $request ? $request : Request::createFromGlobals();
     $host = $request->getHost();
     foreach ($rules as $env => $rule) {
         if (is_callable($rule)) {
             static::$env = $env;
         } elseif (preg_match($rule, $host)) {
             static::$env = $env;
             break;
         }
     }
     static::loadEnvironment(static::$env);
     return static::$env;
 }
Ejemplo n.º 2
0
 public static function getIp()
 {
     return \Request::getClientIp();
 }