當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。