当前位置: 首页>>代码示例>>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;未经允许,请勿转载。