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


PHP Application::runningInConsole方法代码示例

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


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

示例1: setupSeeds

 /**
  * Setup the seeds.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function setupSeeds(Application $app)
 {
     $source = realpath(__DIR__ . '/../database/seeds/');
     if ($app instanceof LaravelApplication && $app->runningInConsole()) {
         $this->publishes([$source => database_path('seeds')], 'seeds');
     }
 }
开发者ID:jnaxo,项目名称:country-codes,代码行数:14,代码来源:CountryCodesServiceProvider.php

示例2: isRunningInConsole

 /**
  * Determine if the app is running in the console.
  *
  * To allow testing this will return false the environment is testing.
  *
  * @return bool
  */
 public function isRunningInConsole()
 {
     if ($this->app->environment('testing')) {
         return false;
     }
     return $this->app->runningInConsole();
 }
开发者ID:zedx,项目名称:core,代码行数:14,代码来源:CacheProfile.php

示例3: load

 /**
  * Register the application service providers.
  *
  * @param  array  $providers
  * @return void
  */
 public function load(array $providers)
 {
     $manifest = $this->loadManifest();
     // First we will load the service manifest, which contains information on all
     // service providers registered with the application and which services it
     // provides. This is used to know which services are "deferred" loaders.
     if ($this->shouldRecompile($manifest, $providers)) {
         $manifest = $this->compileManifest($providers);
     }
     // If the application is running in the console, we will not lazy load any of
     // the service providers. This is mainly because it's not as necessary for
     // performance and also so any provided Artisan commands get registered.
     if ($this->app->runningInConsole()) {
         $manifest['eager'] = $manifest['providers'];
     }
     // Next, we will register events to load the providers for each of the events
     // that it has requested. This allows the service provider to defer itself
     // while still getting automatically loaded when a certain event occurs.
     foreach ($manifest['when'] as $provider => $events) {
         $this->registerLoadEvents($provider, $events);
     }
     // We will go ahead and register all of the eagerly loaded providers with the
     // application so their services can be registered with the application as
     // a provided service. Then we will set the deferred service list on it.
     foreach ($manifest['eager'] as $provider) {
         $this->app->register($this->createProvider($provider));
     }
     $this->app->setDeferredServices($manifest['deferred']);
 }
开发者ID:devonzara,项目名称:framework,代码行数:35,代码来源:ProviderRepository.php

示例4: handleException

 /**
  * Handle an uncaught exception from the application.
  *
  * Note: Most exceptions can be handled via the try / catch block in
  * the HTTP and Console kernels. But, fatal error exceptions must
  * be handled differently since they are not normal exceptions.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function handleException($e)
 {
     $this->getExceptionHandler()->report($e);
     if ($this->app->runningInConsole()) {
         $this->renderForConsole($e);
     } else {
         $this->renderHttpResponse($e);
     }
 }
开发者ID:visualturk,项目名称:framework,代码行数:19,代码来源:HandleExceptions.php

示例5: handleException

 /**
  * Handle an uncaught exception from the application.
  *
  * Note: Most exceptions can be handled via the try / catch block in
  * the HTTP and Console kernels. But, fatal error exceptions must
  * be handled differently since they are not normal exceptions.
  *
  * @param  \Throwable  $e
  * @return void
  */
 public function handleException($e)
 {
     if (!$e instanceof Exception) {
         $e = new FatalThrowableError($e);
     }
     $this->getExceptionHandler()->report($e);
     if ($this->app->runningInConsole()) {
         $this->renderForConsole($e);
     } else {
         $this->renderHttpResponse($e);
     }
 }
开发者ID:thirdgerb,项目名称:commune-framework,代码行数:22,代码来源:HandleExceptions.php

示例6: boot

 public function boot(Application $app)
 {
     $source = realpath(__DIR__ . '/migrations/');
     if ($app->runningInConsole()) {
         $this->publishes([$source => database_path('migrations')], 'migrations');
     }
 }
开发者ID:alfred-nutile-inc,项目名称:route-tracking,代码行数:7,代码来源:RouteTrackingProvider.php

示例7: setupMigrations

 /**
  * Setup the migrations.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function setupMigrations(Application $app)
 {
     $source = realpath(__DIR__ . '/../database/migrations/');
     if (class_exists('Illuminate\\Foundation\\Application', false) && $app->runningInConsole()) {
         $this->publishes([$source => database_path('migrations')], 'migrations');
     }
 }
开发者ID:Scaledesk,项目名称:travally.in,代码行数:14,代码来源:OAuth2ServerServiceProvider.php

示例8: initMigration

 /**
  * Copy migration to resources
  *
  * @param Application $app
  */
 private function initMigration(Application $app)
 {
     if ($app instanceof \Illuminate\Foundation\Application && $app->runningInConsole()) {
         $migrationPath = realpath(__DIR__ . '/../database/migrations');
         $this->publishes([$migrationPath => database_path('migrations')]);
     }
 }
开发者ID:tuanlq11,项目名称:auditing,代码行数:12,代码来源:AuditingProvider.php

示例9: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     /** @var \Illuminate\Foundation\Application $app*/
     $env = $app->environment();
     $filesystem = $this->files = new Filesystem();
     $loader = new FileLoader($filesystem, $app['path.config']);
     $config = new Repository($loader, $filesystem, $env);
     $loader->setRepository($config);
     $app->instance('config', $config);
     $configuredLoader = $app['config']->get('laradic_config.loader');
     if (isset($configuredLoader) && $configuredLoader !== 'file') {
         if ($configuredLoader === 'db') {
             $loader = new DatabaseLoader($filesystem, $app['path.config']);
             $config->setLoader($loader);
             $app->booted(function () use($app, $loader, $config) {
                 $loader->setDatabase($app['db']->connection());
                 $loader->setDatabaseTable($app['config']->get('laradic_config.loaders.db.table'));
             });
             $loader->setRepository($config);
         }
     }
     if (file_exists($cached = $app->getCachedConfigPath()) && !$app->runningInConsole()) {
         $items = (require $cached);
         $loadedFromCache = true;
     }
     if (!isset($loadedFromCache)) {
         # $this->loadConfigurationFiles($app, $config);
     }
     date_default_timezone_set($config['app.timezone']);
     mb_internal_encoding('UTF-8');
 }
开发者ID:laradic,项目名称:config,代码行数:37,代码来源:LoadConfiguration.php

示例10: initCMS

 /**
  * Copy migration to root project
  *
  * @param Application $app
  */
 private function initCMS(Application $app)
 {
     if ($app instanceof \Illuminate\Foundation\Application && $app->runningInConsole()) {
         $migrationPath = realpath(__DIR__ . '/migration');
         (new Filesystem())->makeDirectory(app_path('Models'), 0755, false, true);
         $this->publishes([$migrationPath => database_path('migrations'), __DIR__ . "/module" => app_path('Http/Modules'), __DIR__ . "/resource" => resource_path(), __DIR__ . "/gulp" => base_path(), __DIR__ . "/configs" => config_path('cms')]);
     }
 }
开发者ID:tuanlq11,项目名称:cms,代码行数:13,代码来源:CMSProvider.php

示例11: setupConfig

 /**
  * Setup the config.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function setupConfig(Application $app)
 {
     $source = realpath(__DIR___ . '/../config/gitlib.php');
     if ($app instanceof LaravelApplication && $app->runningInConsole()) {
         $this->publishes([$source => config_path('gitlib.php')]);
     } elseif ($app instanceof LumanApplication) {
         $app->configure('gitlib');
     }
     $this->mergeConfigFrom($source, 'gitlib');
 }
开发者ID:phecho,项目名称:Gitlib,代码行数:17,代码来源:GitlibServiceProvider.php

示例12: setupConfig

 /**
  * Setup the config.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function setupConfig(Application $app)
 {
     $source = realpath(__DIR__ . '/../config/pusher.php');
     if (class_exists('Illuminate\\Foundation\\Application', false) && $app->runningInConsole()) {
         $this->publishes([$source => config_path('pusher.php')]);
     } elseif (class_exists('Laravel\\Lumen\\Application', false)) {
         $app->configure('pusher');
     }
     $this->mergeConfigFrom($source, 'pusher');
 }
开发者ID:hiddenloop,项目名称:pusher,代码行数:17,代码来源:PusherServiceProvider.php

示例13: setupConfig

 /**
  * Setup the config.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function setupConfig(Application $app)
 {
     $source = __DIR__ . '/config/telegram.php';
     if ($app instanceof LaravelApplication && $app->runningInConsole()) {
         $this->publishes([$source => config_path('telegram.php')]);
     } elseif ($app instanceof LumenApplication) {
         $app->configure('telegram');
     }
     $this->mergeConfigFrom($source, 'telegram');
 }
开发者ID:emayk,项目名称:telegram-bot-sdk,代码行数:17,代码来源:TelegramServiceProvider.php

示例14: error

 protected function error(\Exception $e)
 {
     global $argv;
     if ($this->app->runningInConsole() && in_array('package:publish', $argv)) {
         $command = $this->container->command();
         if ($command) {
             $command->error($e->getMessage());
         }
         return;
     }
     throw $e;
 }
开发者ID:mvalim,项目名称:package-utils,代码行数:12,代码来源:Publisher.php

示例15: handle

 /**
  * Handle the command.
  *
  * @param Application $application
  */
 public function handle(Application $application, Laravel $laravel)
 {
     $app = env('APPLICATION_REFERENCE', 'default');
     if ($laravel->runningInConsole()) {
         $app = (new ArgvInput())->getParameterOption('--app', $app);
         $laravel->bind('path.public', function () use($laravel) {
             if ($path = env('PUBLIC_PATH')) {
                 return base_path($path);
             }
             // Check default path.
             if (file_exists($path = base_path('public/index.php'))) {
                 return dirname($path);
             }
             // Check common alternative.
             if (file_exists($path = base_path('public_html/index.php'))) {
                 return dirname($path);
             }
             return base_path('public');
         });
     }
     /**
      * Set the reference to our default first.
      * When in a dev environment and working
      * with Artisan this the same as locating.
      */
     $application->setReference($app);
     /**
      * If the application is installed
      * then locate the application and
      * initialize.
      */
     if ($application->isInstalled()) {
         if (env('DB_DRIVER')) {
             $application->locate();
             $application->setup();
         }
         return;
     }
     /**
      * If we're not installed just
      * assume default for now.
      */
     $application->setReference('default');
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:49,代码来源:InitializeApplication.php


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