diff --git a/src/Console/TwigViewClearCommand.php b/src/Console/TwigViewClearCommand.php index 2a023ea..7dec70b 100644 --- a/src/Console/TwigViewClearCommand.php +++ b/src/Console/TwigViewClearCommand.php @@ -4,7 +4,6 @@ use Illuminate\Console\Command; use Illuminate\Filesystem\Filesystem; -use Illuminate\Foundation\Console\ViewClearCommand; use RuntimeException; class TwigViewClearCommand extends Command @@ -15,25 +14,18 @@ class TwigViewClearCommand extends Command /** @var string */ protected $description = 'Clear all compiled view files'; - /** @var \Illuminate\Foundation\Console\ViewClearCommand */ - protected $viewClearCommand; - /** @var \Illuminate\Filesystem\Filesystem */ protected $files; - public function __construct(ViewClearCommand $viewClearCommand, Filesystem $files) + public function __construct(Filesystem $files) { parent::__construct(); - $this->viewClearCommand = $viewClearCommand; - $this->files = $files; } public function handle() { - $this->viewClearCommand->handle(); - $path = $this->laravel['config']['view.compiled']; if (! $path) { @@ -45,6 +37,9 @@ public function handle() $this->files->deleteDirectory($view); continue; } + if ($this->files->isFile($view)) { + $this->files->delete($view); + } } $this->info('Compiled twig views cleared!'); diff --git a/src/TwigServiceProvider.php b/src/TwigServiceProvider.php index 0795d9b..efd25bb 100644 --- a/src/TwigServiceProvider.php +++ b/src/TwigServiceProvider.php @@ -89,7 +89,7 @@ protected function registerViewExtensions() protected function registerCommands() { $this->app->extend('command.view.clear', function ($abstract, $app) { - return new TwigViewClearCommand($abstract, $app['files']); + return new TwigViewClearCommand($app['files']); }); } }