Skip to content

Commit 86a7586

Browse files
authored
Merge pull request #3 from pierophp/laravel54
Laravel54
2 parents 199f107 + 1de609c commit 86a7586

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/Console/Commands/GenerateConfigCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ public function __construct()
3838
*/
3939
public function handle(SupervisorGenerator $generator)
4040
{
41-
$generator->generate();
41+
try {
42+
$generator->generate();
43+
} catch (\Throwable $e) {
44+
$this->error($e->getMessage());
45+
}
46+
4247
$this->info('Configuration generated in the ' . $generator->getFilename() . ' file!');
4348
}
4449
}

src/Console/Commands/ShowJobsCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ public function handle()
6161
];
6262
}
6363

64-
$this->table(array_keys($table[0]), $table);
64+
if (count($table)) {
65+
$this->table(array_keys($table[0]), $table);
66+
} else {
67+
$this->info("\nNo results found");
68+
}
69+
6570
$this->info("\nUsage:");
6671
$this->comment("php artisan queue-manager:generate-queue job_name param1=1,param2=0\n");
6772

src/Providers/LaravelQueueManagerServiceProvider.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace LaravelQueueManager\Providers;
44

55
use Illuminate\Console\Scheduling\Schedule;
6-
use Illuminate\Support\Facades\View;
76
use Illuminate\Support\ServiceProvider;
87
use LaravelQueueManager\Console\Commands\GenerateConfigCommand;
98
use LaravelQueueManager\Console\Commands\GenerateQueueCommand;
@@ -31,7 +30,7 @@ public function boot()
3130
__DIR__ . '/../migrations/2016_10_21_153409_queue_config_add_connection.php' => database_path('migrations/2016_10_21_153409_queue_config_add_connection.php'),
3231
]);
3332

34-
View::addNamespace('laravel_queue_manager', __DIR__ . '/../resources/views');
33+
\View::addNamespace('laravel_queue_manager', __DIR__ . '/../resources/views');
3534

3635
$this->schedule();
3736
$this->commands('queue-manager.generate-config');
@@ -75,21 +74,20 @@ public function register()
7574
*/
7675
protected function registerCommand()
7776
{
78-
$this->app['queue-manager.generate-config'] = $this->app->share(function () {
77+
$this->app->singleton('queue-manager.generate-config', function () {
7978
return new GenerateConfigCommand();
8079
});
8180

82-
$this->app['queue-manager.generate-queue'] = $this->app->share(function () {
81+
$this->app->singleton('queue-manager.generate-queue', function () {
8382
return new GenerateQueueCommand();
8483
});
8584

86-
$this->app['queue-manager.show-jobs'] = $this->app->share(function () {
85+
$this->app->singleton('queue-manager.show-jobs', function () {
8786
return new ShowJobsCommand();
8887
});
8988

90-
$this->app['queue-manager.work'] = $this->app->share(function () {
89+
$this->app->singleton('queue-manager.work', function () {
9190
return new WorkCommand(new Worker(resolve('Illuminate\Queue\QueueManager'), resolve('Illuminate\Contracts\Events\Dispatcher'), resolve('Illuminate\Contracts\Debug\ExceptionHandler')));
9291
});
93-
9492
}
9593
}

0 commit comments

Comments
 (0)