Skip to content

Commit

Permalink
Update capsule provider booting and registration (fixing view:cache)
Browse files Browse the repository at this point in the history
  • Loading branch information
ifox committed Jun 7, 2021
1 parent d066e3d commit 5a086a3
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/CapsulesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,14 @@ protected function mergeTwillConfig()
}

public function register()
{
$this->registerConfig();
}

protected function registerConfig()
{
$this->registerManager();

$this->mergeTwillConfig();
}

public function boot()
{
$this->registerCapsules();

$this->registerViewPaths();
}

Expand All @@ -57,14 +53,16 @@ protected function registerCapsule($capsule)

public function registerViewPaths()
{
$callback = function ($view) {
$view->addLocation(config('twill.capsules.path'));
};
if (file_exists(config('twill.capsules.path'))) {
$callback = function ($view) {
$view->addLocation(config('twill.capsules.path'));
};

$this->app->afterResolving('view', $callback);
$this->app->afterResolving('view', $callback);

if ($this->app->resolved('view')) {
$callback($this->app->make('view'), $this->app);
if ($this->app->resolved('view')) {
$callback($this->app->make('view'), $this->app);
}
}
}

Expand Down

0 comments on commit 5a086a3

Please sign in to comment.