本文整理汇总了PHP中Illuminate\Support\Facades\Facade::clearResolvedInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Facade::clearResolvedInstance方法的具体用法?PHP Facade::clearResolvedInstance怎么用?PHP Facade::clearResolvedInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Facade
的用法示例。
在下文中一共展示了Facade::clearResolvedInstance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendRequestThroughRouter
/**
* Send the given request through the middleware / router.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
protected function sendRequestThroughRouter($request)
{
$this->app->instance('request', $request);
Facade::clearResolvedInstance('request');
$this->bootstrap();
return (new Pipeline($this->app))->send($request)->through($this->middleware)->then($this->dispatchToRouter());
}
示例2: sendRequestThroughRouter
/**
* Send the given request through the middleware / router.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
protected function sendRequestThroughRouter($request)
{
$this->app->instance('request', $request);
Facade::clearResolvedInstance('request');
$this->bootstrap();
// If administration panel is attempting to be displayed,
// we don't need any response
if (is_admin()) {
return;
}
// Get response on `template_include` filter so the conditional functions work correctly
add_filter('template_include', function ($template) use($request) {
// If the template is not index.php, then don't output anything
if ($template !== get_template_directory() . '/index.php') {
return $template;
}
try {
$response = (new Pipeline($this->app))->send($request)->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)->then($this->dispatchToRouter());
} catch (Exception $e) {
$this->reportException($e);
$response = $this->renderException($request, $e);
} catch (Throwable $e) {
$this->reportException($e = new FatalThrowableError($e));
$response = $this->renderException($request, $e);
}
$this->app['events']->fire('kernel.handled', [$request, $response]);
return $template;
}, PHP_INT_MAX);
}
示例3: sendRequestThroughRouter
/**
* Send the given request through the middleware / router.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
protected function sendRequestThroughRouter($request)
{
$this->app->instance('request', $request);
Facade::clearResolvedInstance('request');
$this->bootstrap();
$shouldSkipMiddleware = $this->app->bound('middleware.disable') && $this->app->make('middleware.disable') === true;
return (new Pipeline($this->app))->send($request)->through($shouldSkipMiddleware ? [] : $this->middleware)->then($this->dispatchToRouter());
}
示例4: setUp
public function setUp()
{
parent::setUp();
// reset configs
Facade::clearResolvedInstance('reactjs');
$this->app['config']->set('basepath', '');
$this->app['config']->set('react_src', '');
$this->app['config']->set('src_files', []);
$this->app['config']->set('react_prefix', '');
$this->app['config']->set('components_prefix', '');
}
示例5: __construct
/**
* Create do provider.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*/
public function __construct($app)
{
parent::__construct($app);
// Trocar instancias
foreach ($this->instances as $provider => $classServiceProvider) {
// Limpar facade
Facade::clearResolvedInstance($provider);
// Trocar / Criar
$this->app->instance($provider, new $classServiceProvider($app));
}
}
示例6: onRequest
public function onRequest($request, $response, $illuminate_request = false)
{
// for file system
clearstatcache();
if (config('laravoole.base_config.deal_with_public')) {
if ($this->dealWithPublic($request, $response)) {
return;
}
}
try {
$kernel = $this->kernel;
if (!$illuminate_request) {
$illuminate_request = $this->dealWithRequest($request);
}
$illuminate_response = $kernel->handle($illuminate_request);
// Is gzip enabled and the client accept it?
$accept_gzip = config('laravoole.base_config.gzip') && isset($request->header['Accept-Encoding']) && stripos($request->header['Accept-Encoding'], 'gzip') !== false;
$this->dealWithResponse($response, $illuminate_response, $accept_gzip);
} catch (\Exception $e) {
echo '[ERR] ' . $e->getFile() . '(' . $e->getLine() . '): ' . $e->getMessage() . PHP_EOL;
echo $e->getTraceAsString() . PHP_EOL;
} catch (\Throwable $e) {
echo '[ERR] ' . $e->getFile() . '(' . $e->getLine() . '): ' . $e->getMessage() . PHP_EOL;
echo $e->getTraceAsString() . PHP_EOL;
} finally {
if (isset($illuminate_response)) {
$kernel->terminate($illuminate_request, $illuminate_response);
}
if ($illuminate_request->hasSession()) {
$illuminate_request->getSession()->clear();
}
if ($this->app->isProviderLoaded(\Illuminate\Auth\AuthServiceProvider::class)) {
$this->app->register(\Illuminate\Auth\AuthServiceProvider::class, [], true);
Facade::clearResolvedInstance('auth');
}
return $response;
}
}
示例7: refreshRequest
/**
* Refresh the bound request instance in the container.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
protected function refreshRequest(Request $request)
{
$this->instance('request', $request);
Facade::clearResolvedInstance('request');
}
示例8: init
/**
* Send the given request through the middleware / router.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function init($request)
{
$this->app->instance('request', $request);
Facade::clearResolvedInstance('request');
$this->bootstrap();
}
示例9: handle
/**
* Handle the given request and get the response.
*
* Provides compatibility with BrowserKit functional testing.
*
* @implements HttpKernelInterface::handle
*
* @param \Illuminate\Http\Request $request
* @param int $type
* @param bool $catch
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$this->instance('request', $request);
Facade::clearResolvedInstance('request');
return $this->dispatch($request);
}
示例10: injectRequest
protected function injectRequest(CmsRequest $request)
{
$this->app->instance('request', $request);
Facade::clearResolvedInstance('request');
}