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


PHP App::runningInConsole方法代码示例

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


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

示例1: __construct

 public function __construct($init = false)
 {
     $this->filter = ['filter' => [], 'setSize' => '10', 'bookmarkKey' => ''];
     if (!App::runningInConsole() || App::runningInConsole() && $init == true) {
         $this->client = new NTLMSoapClient(config('levapp.navision.url'));
     }
 }
开发者ID:dagmawiyehenew,项目名称:laravel-levapp,代码行数:7,代码来源:NavisionService.php

示例2: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     if (!App::runningInConsole()) {
         //código para não executar quando estamos rodando a aplicação via console
         ProjectTask::created(function ($task) {
             Event::fire(new TaskWasIncluded($task));
         });
     }
 }
开发者ID:BrunoLagoa,项目名称:laravel_codeproject,代码行数:14,代码来源:AppServiceProvider.php

示例3: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     $this->registerPolicies($gate);
     if (!App::runningInConsole()) {
         foreach ($this->getPermissions() as $permission) {
             $gate->define($permission->name, function ($user) use($permission) {
                 return $user->hasRole($permission->roles) || $user->isAdmin();
             });
         }
     }
 }
开发者ID:codeedu,项目名称:laravel52-carnaval,代码行数:17,代码来源:AuthServiceProvider.php

示例4: isAuditEnabled

 /**
  * Determine whether audit enabled.
  *
  * @return bool
  */
 public static function isAuditEnabled()
 {
     if (App::runningInConsole() && !Config::get('auditing.audit_console')) {
         return false;
     }
     return true;
 }
开发者ID:owen-it,项目名称:laravel-auditing,代码行数:12,代码来源:Auditable.php

示例5: beforeRoute

 protected function beforeRoute()
 {
     if (App::runningInConsole()) {
         return;
     }
     $request = request();
     $locales = app('translator.manager')->getLocales();
     if (!$locales) {
         $locales = [app()->getLocale() => app()->getLocale()];
     }
     if (array_key_exists($request->segment(1), $locales)) {
         $this->serverModify($request, $locales);
     }
 }
开发者ID:jooorooo,项目名称:multi-language,代码行数:14,代码来源:MultiLanguageServiceProvider.php

示例6: registerIfNotInstalled

 /**
  * Register the service provider.
  *
  * @return void
  */
 private function registerIfNotInstalled()
 {
     $filemanager = $this->app['installer']->getFileManager();
     include_once __DIR__ . '/Routes/routes.php';
     if (($install = $filemanager->isInstalled()) !== false ? $filemanager->isUpdatable() : true) {
         if (App::runningInConsole()) {
             if ($this->allowCommand()) {
                 return;
             }
             exit('You must run command: php artisan ' . (!$install ? 'app:install' : 'app:upgrade'));
         }
         if (!$this->app['request']->is('Installer@*') && !$this->app['request']->is('*/Installer@*')) {
             $this->redirectTo(route(!$install ? 'installer::welcome' : 'installer::upgrade'));
         }
     }
 }
开发者ID:znsstudio,项目名称:installer,代码行数:21,代码来源:InstallerServiceProvider.php

示例7:

        return View::make('404');
    }
});
App::error(function (InvalidOpenIdMessageException $exception, $code) {
    Log::error($exception);
    if (!App::runningInConsole()) {
        $checkpoint_service = ServiceLocator::getInstance()->getService(UtilsServiceCatalog::CheckPointService);
        if ($checkpoint_service) {
            $checkpoint_service->trackException($exception);
        }
        return View::make('404');
    }
});
App::error(function (InvalidOAuth2Request $exception, $code) {
    Log::error($exception);
    if (!App::runningInConsole()) {
        $checkpoint_service = ServiceLocator::getInstance()->getService(UtilsServiceCatalog::CheckPointService);
        if ($checkpoint_service) {
            $checkpoint_service->trackException($exception);
        }
        return View::make('404');
    }
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenace mode is in effect for this application.
开发者ID:smarcet,项目名称:openstackid,代码行数:31,代码来源:global.php

示例8: findOrFail

 /**
  * A little hack to reconnect to the database if we're in console mode and trying to find a deployment.
  * Should fix the error sending STMT_PREPARE problem that causes deployments to sit "pending" forever.
  * @return mixed
  */
 public function findOrFail()
 {
     if (App::runningInConsole()) {
         DB::reconnect();
     }
     return parent::__call('findOrFail', func_get_args());
 }
开发者ID:joykuang,项目名称:deployer,代码行数:12,代码来源:Deployment.php


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