當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::environment方法代碼示例

本文整理匯總了PHP中Illuminate\Contracts\Foundation\Application::environment方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::environment方法的具體用法?PHP Application::environment怎麽用?PHP Application::environment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Contracts\Foundation\Application的用法示例。


在下文中一共展示了Application::environment方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getModeByEnv

 /**
  * Get checking mode by laravel environment.
  *
  * @param string|null $env
  *
  * @return string
  */
 protected function getModeByEnv($env = null)
 {
     if (is_null($env)) {
         $env = $this->app->environment();
     }
     return in_array($env, $this->productionEnvironments) ? 'Production' : 'Dev';
 }
開發者ID:arrilot,項目名稱:laravel-systemcheck,代碼行數:14,代碼來源:ChecksCollection.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  *
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance() && $this->app->environment() != 'testing') {
         throw new HttpException(503, 'Server is currently undergoing maintenance. We should be ' . 'back up shortly.');
     }
     return $next($request);
 }
開發者ID:revolverobotics,項目名稱:tools-laravel-microservice,代碼行數:16,代碼來源:CheckForMaintenanceMode.php

示例3: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure() && $this->app->environment() === 'production') {
         return redirect()->secure($request->getRequestUri());
     }
     return $next($request);
 }
開發者ID:mlanin,項目名稱:go,代碼行數:14,代碼來源:Secure.php

示例4: 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

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->environment() === 'production') {
         // for Proxies
         Request::setTrustedProxies([$request->getClientIp()]);
         if (!$request->isSecure()) {
             return redirect()->secure($request->getRequestUri());
         }
     }
     return $next($request);
 }
開發者ID:shin1x1,項目名稱:laravel-force-https-url-scheme,代碼行數:18,代碼來源:ForceHttpsUrlScheme.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if ('testing' === $this->app->environment() && $request->has('_token')) {
         $input = $request->all();
         $input['_token'] = $request->session()->token();
         // we need to update _token value to make sure we get the POST / PUT tests passed.
         Log::debug('Input token replaced (' . $input['_token'] . ').');
         $request->replace($input);
     }
     return $next($request);
 }
開發者ID:webenhanced,項目名稱:firefly-iii,代碼行數:19,代碼來源:ReplaceTestVars.php

示例7: 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

示例8: registerLogger

 /**
  * Register the logger instance in the container.
  *
  * @param  \Illuminate\Foundation\Application|Application $app
  * @return \Illuminate\Log\Writer
  */
 protected function registerLogger(Application $app)
 {
     $logger = new Logger($app->environment());
     //< do not move this! it might produce "Class declarations may not be nested" error
     $log = new Writer($logger, $app['events']);
     $app->instance('log', $log);
     return $log;
 }
開發者ID:swayok,項目名稱:laravel-extended-errors,代碼行數:14,代碼來源:ConfigureLogging.php

示例9: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application $application
  *
  * @return void
  */
 public function bootstrap(Application $application)
 {
     $loader = new FileLoader(new Filesystem(), $application['path'] . DIRECTORY_SEPARATOR . 'configurations');
     $application->instance('config', $configuration = new Repository($loader, $application->environment()));
     if (!isset($loadedFromCache)) {
         $this->loadConfigurationFiles($application, $configuration);
     }
     mb_internal_encoding('UTF-8');
 }
開發者ID:notadd,項目名稱:framework,代碼行數:16,代碼來源:LoadConfiguration.php

示例10: getConfigurationFiles

 protected function getConfigurationFiles(Application $app)
 {
     $configPath = str_finish($app->configPath(), '/');
     $files = $this->getConfigurationFilesInPath($configPath);
     foreach (explode('.', $app->environment()) as $env) {
         $configPath .= $env . '/';
         $files = array_merge_recursive($files, $this->getConfigurationFilesInPath($configPath));
     }
     return $files;
 }
開發者ID:KinaMarie,項目名稱:laravel-5-base-app-support,代碼行數:10,代碼來源:LoadConfiguration.php

示例11: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     $this->app = $app;
     error_reporting(-1);
     set_error_handler([$this, 'handleError']);
     set_exception_handler([$this, 'handleException']);
     register_shutdown_function([$this, 'handleShutdown']);
     if (!$app->environment('testing')) {
         ini_set('display_errors', 'Off');
     }
 }
開發者ID:thirdgerb,項目名稱:commune-framework,代碼行數:17,代碼來源:HandleExceptions.php

示例12: loadData

 /**
  * Overwrite the original config value based
  * on environment name.
  *
  * @param array        $configs
  * @param Closure|null $closure
  *
  * @return void
  */
 protected function loadData($configs, Closure $closure = null)
 {
     if (is_null($configs)) {
         return false;
     }
     foreach ($configs as $env => $config) {
         $env = $this->explodeEnvironment($env);
         if (is_array($env)) {
             foreach ($env as $_env) {
                 if ($this->app->environment($_env)) {
                     $closure($config);
                 }
             }
         } else {
             if ($this->app->environment($env)) {
                 $closure($config);
             }
         }
     }
 }
開發者ID:jenky,項目名稱:laravel-envloader,代碼行數:29,代碼來源:Loader.php

示例13: index

 /**
  * index.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  * @param \Recca0120\Terminal\Kernel                   $kernel
  * @param \Illuminate\Http\Request                     $request
  * @param \Illuminate\Contracts\Response\Factory       $responseFactory
  * @param \Illuminate\Contracts\Routing\UrlGenerator   $urlGenerator
  * @param string                                       $view
  *
  * @return mixed
  */
 public function index(Application $app, Kernel $kernel, Request $request, ResponseFactory $responseFactory, UrlGenerator $urlGenerator, $view = 'index')
 {
     $kernel->call('--ansi');
     $csrfToken = null;
     if ($request->hasSession() === true) {
         $csrfToken = $request->session()->token();
     }
     $options = json_encode(['csrfToken' => $csrfToken, 'username' => 'LARAVEL', 'hostname' => php_uname('n'), 'os' => PHP_OS, 'basePath' => $app->basePath(), 'environment' => $app->environment(), 'version' => $app->version(), 'endpoint' => $urlGenerator->action('\\' . static::class . '@endpoint'), 'helpInfo' => $kernel->output(), 'interpreters' => ['mysql' => 'mysql', 'artisan tinker' => 'tinker', 'tinker' => 'tinker'], 'confirmToProceed' => ['artisan' => ['migrate', 'migrate:install', 'migrate:refresh', 'migrate:reset', 'migrate:rollback', 'db:seed']]]);
     $id = $view === 'panel' ? Str::random(30) : null;
     return $responseFactory->view('terminal::' . $view, compact('options', 'resources', 'id'));
 }
開發者ID:recca0120,項目名稱:terminal,代碼行數:23,代碼來源:TerminalController.php

示例14: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application $application
  *
  * @return void
  */
 public function bootstrap(Application $application)
 {
     $this->app = $application;
     error_reporting(-1);
     set_error_handler([$this, 'handleError']);
     set_exception_handler([$this, 'handleException']);
     register_shutdown_function([$this, 'handleShutdown']);
     if (!$application->environment('testing')) {
         ini_set('display_errors', 'Off');
     }
     if ($application->make('config')->get('app.debug')) {
         ini_set('display_errors', true);
     }
 }
開發者ID:notadd,項目名稱:framework,代碼行數:21,代碼來源:HandleExceptions.php

示例15: bootstrap

 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     $logger = new Writer(new Monolog($app->environment()), $app['events']);
     // Daily files are better for production stuff
     $logger->useDailyFiles(storage_path('/logs/laravel.log'));
     $app->instance('log', $logger);
     // Next we will bind the a Closure to resolve the PSR logger implementation
     // as this will grant us the ability to be interoperable with many other
     // libraries which are able to utilize the PSR standardized interface.
     $app->bind('Psr\\Log\\LoggerInterface', function ($app) {
         return $app['log']->getMonolog();
     });
     $app->bind('Illuminate\\Contracts\\Logging\\Log', function ($app) {
         return $app['log'];
     });
 }
開發者ID:bitbitdecker,項目名稱:bitcoin-faucet-rotator,代碼行數:22,代碼來源:ConfigureLogging.php


注:本文中的Illuminate\Contracts\Foundation\Application::environment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。