Skip to content

Commit 5ad65d0

Browse files
committed
Clear the cached facade after internal requests as well.
Signed-off-by: Jason Lewis <[email protected]>
1 parent 209bccc commit 5ad65d0

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/Dispatcher.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,7 @@ protected function createRequest($verb, $uri, $parameters)
490490
$this->version = $this->config->getVersion();
491491
}
492492

493-
$groups = $this->router->getApiGroups();
494-
495-
if (isset($this->domain)) {
496-
$api = $groups->getByDomain($this->domain, $this->version);
497-
} else {
498-
$api = $groups->getByVersion($this->version);
499-
}
493+
$api = $this->router->getApiGroups()->getByDomainOrVersion($this->domain, $this->version);
500494

501495
if (($prefix = $api->option('prefix')) && ! starts_with($uri, $prefix)) {
502496
$uri = sprintf('%s/%s', $prefix, $uri);
@@ -586,6 +580,8 @@ protected function refreshRequestStack()
586580

587581
$this->replaceRequestInstance();
588582

583+
$this->clearCachedFacadeInstance();
584+
589585
$this->raw = false;
590586

591587
$this->version = $this->domain = $this->content = null;

src/Routing/GroupCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function getByDomainOrVersion($domain, $version)
151151
public function getByOptions($options)
152152
{
153153
return array_where($this->groups, function ($key, $collection) use ($options) {
154-
if ($collection->matchesDomain($options['domain'], $options['version'])) {
154+
if (isset($options['domain']) && $collection->matchesDomain($options['domain'], $options['version'])) {
155155
return true;
156156
} elseif ($collection->matchesVersion($options['version'])) {
157157
return true;

src/Routing/Router.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ protected function setupGroupOptions($options)
154154

155155
$options['version'] = (array) $options['version'];
156156

157-
if (! isset($options['prefix'])) {
158-
$options['prefix'] = $this->config->getPrefix();
157+
if (! isset($options['prefix']) && $prefix = $this->config->getPrefix()) {
158+
$options['prefix'] = $prefix;
159159
}
160160

161-
if (! isset($options['domain'])) {
162-
$options['domain'] = $this->config->getDomain();
161+
if (! isset($options['domain']) && $domain = $this->config->getDomain()) {
162+
$options['domain'] = $domain;
163163
}
164164

165165
if (isset($options['conditional_request'])) {

0 commit comments

Comments
 (0)