本文整理汇总了PHP中Illuminate\Container\Container::environment方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::environment方法的具体用法?PHP Container::environment怎么用?PHP Container::environment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Container\Container
的用法示例。
在下文中一共展示了Container::environment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// check for debugging locally, which should not require the headers
if ($this->app->environment() === 'local' && $request->input(config('jsonapi.identifiers.request.debug'))) {
$request->header('Content-type', 'text/html', true);
return $next($request);
}
if (!$this->acceptHeaderValid($request)) {
return response('', 406);
}
if (!$this->contentTypeHeaderValid($request)) {
return response('', 415);
}
return $this->addHeader($next($request));
}
示例2: checkRunningEligibility
/**
* Checks the web eligibility for Platform. If true, Platform
* is safe to run in the web.
*
* @return bool
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*/
public function checkRunningEligibility()
{
// If we're running in console, we're always fine to
// run Platform except for testing.
if ($this->app->runningInConsole()) {
return $this->app->environment() !== 'testing';
}
if ($this->isInstalled()) {
// Now, let's check for database connectivity. If we have no
// connectivity, the database connection is probably lost.
// This means the service is in fact unavailable.
try {
$this->app['db']->connection();
return true;
} catch (PDOException $e) {
throw new HttpException(503, 'Database connection could not be established.');
}
}
// Check if the path is on the eligibility whitelist
return in_array($this->app['request']->path(), $this->eligibilityWhitelist);
}
示例3: isTestingEnviroment
/**
* Returns flag on testing enviroment
*
* @return bool
*/
public function isTestingEnviroment()
{
return $this->app->runningInConsole() && $this->app->environment() === 'testing';
}