Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Nov 28, 2023
2 parents 48a0816 + a08c303 commit 0faff3f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Concerns/CanServeSite.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ public static function reloadServing(): void
*/
public function beforeServingApplication(Closure|string $closure): void
{
after_resolving($this->app, 'config', function ($config, $app) use ($closure) {
/** @var \Illuminate\Foundation\Application $app */
$app = $this->app;

after_resolving($app, 'config', function ($config, $app) use ($closure) {
\is_string($closure) && method_exists($this, $closure)
? $this->{$closure}($app, $config)
: $closure($app, $config);
: value($closure, $app, $config);
});

static::$server?->stash([
Expand Down Expand Up @@ -153,12 +156,13 @@ public function getFreshApplicationToServe(DuskServer $server)
$serializedClosure = unserialize(static::$server->getStash('tweakApplication'));

if ($serializedClosure) {
/** @var (\Closure(\Illuminate\Foundation\Application, \Illuminate\Contracts\Config\Repository):(void))|string $closure */
$closure = \is_string($serializedClosure) ? $serializedClosure : $serializedClosure->getClosure();

after_resolving($this->app, 'config', function ($config, $app) use ($closure) {
after_resolving($app, 'config', function ($config, $app) use ($closure) {
\is_string($closure) && method_exists($this, $closure)
? $this->{$closure}($app, $config)
: $closure($app, $config);
: value($closure, $app, $config);
});
}

Expand Down

0 comments on commit 0faff3f

Please sign in to comment.