Closed stephenjude closed 10 months ago
1.5
10.31.0
8.1.15
MySQL 8.0.32
Calling pennant:purge command via Artisan::call() keeps failing when done outside the terminal.
Like calling it inside a queue job class.
I believe this is because the console commands are registered to only run when the application is running in console.
if ($this->app->runningInConsole()) { $this->offerPublishing(); $this->commands([ \Laravel\Pennant\Commands\FeatureMakeCommand::class, \Laravel\Pennant\Commands\PurgeCommand::class, ]); }
Can we have this check removed so the command can be run from anywhere in the application?
Create a job class and call the the pennant:purge command inside the handle() method like this:
pennant:purge
handle()
public function handle(): void { Artisan::call('pennant:purge'); }
Screenshot:
You should be able to just do the following:
use Laravel\Pennant\FeatureManager; app(FeatureManager::class)->store()->purge();
Thank you @crynobone
Pennant Version
1.5
Laravel Version
10.31.0
PHP Version
8.1.15
Database Driver & Version
MySQL 8.0.32
Description
Calling pennant:purge command via Artisan::call() keeps failing when done outside the terminal.
Like calling it inside a queue job class.
I believe this is because the console commands are registered to only run when the application is running in console.
Can we have this check removed so the command can be run from anywhere in the application?
Steps To Reproduce
Create a job class and call the the
pennant:purge
command inside thehandle()
method like this:Screenshot: