当前位置: 首页>>代码示例>>PHP>>正文


PHP Container::runningInConsole方法代码示例

本文整理汇总了PHP中Illuminate\Container\Container::runningInConsole方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::runningInConsole方法的具体用法?PHP Container::runningInConsole怎么用?PHP Container::runningInConsole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Container\Container的用法示例。


在下文中一共展示了Container::runningInConsole方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkRunningEligibility

 /**
  * Checks the web eligibility for Platform. If true, Platform
  * is safe to run in the web.
  *
  * @return bool
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function checkRunningEligibility()
 {
     // If we're running in console, we're always fine to
     // run Platform except for testing.
     if ($this->app->runningInConsole()) {
         return $this->app->environment() !== 'testing';
     }
     if ($this->isInstalled()) {
         // Now, let's check for database connectivity. If we have no
         // connectivity, the database connection is probably lost.
         // This means the service is in fact unavailable.
         try {
             $this->app['db']->connection();
             return true;
         } catch (PDOException $e) {
             throw new HttpException(503, 'Database connection could not be established.');
         }
     }
     // Check if the path is on the eligibility whitelist
     return in_array($this->app['request']->path(), $this->eligibilityWhitelist);
 }
开发者ID:sohailaammarocs,项目名称:lfc,代码行数:28,代码来源:Platform.php

示例2: isTestingEnviroment

 /**
  * Returns flag on testing enviroment
  *
  * @return bool
  */
 public function isTestingEnviroment()
 {
     return $this->app->runningInConsole() && $this->app->environment() === 'testing';
 }
开发者ID:TheHiddenHaku,项目名称:Jiro,代码行数:9,代码来源:Admin.php


注:本文中的Illuminate\Container\Container::runningInConsole方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。