diff --git a/config/database-schedule.php b/config/database-schedule.php index c58e801..f39d2b3 100644 --- a/config/database-schedule.php +++ b/config/database-schedule.php @@ -90,7 +90,16 @@ 'queue:*', 'schedule:*', 'view:*', - 'phpunit:*' + 'phpunit:*', + 'install:*', + 'channel:*', + 'about', + 'docs', + 'model:*', + 'storage:unlink', + 'lang:publish', + '_complete', + 'completion', ] ], diff --git a/src/DatabaseSchedulingServiceProvider.php b/src/DatabaseSchedulingServiceProvider.php index 13c862f..0f84432 100644 --- a/src/DatabaseSchedulingServiceProvider.php +++ b/src/DatabaseSchedulingServiceProvider.php @@ -13,6 +13,7 @@ use RobersonFaria\DatabaseSchedule\Console\Commands\TestJobCommand; use RobersonFaria\DatabaseSchedule\Console\Commands\ScheduleClearCacheCommand; use RobersonFaria\DatabaseSchedule\Console\Scheduling\Schedule; +use Illuminate\Support\Facades\Schema; class DatabaseSchedulingServiceProvider extends DatabaseScheduleApplicationServiceProvider { @@ -63,8 +64,10 @@ public function boot() } $this->app->resolving(BaseSchedule::class, function ($schedule) { - $schedule = app(Schedule::class, ['schedule' => $schedule]); - return $schedule->execute(); + if (Schema::hasTable('schedules')) { + $schedule = app(Schedule::class, ['schedule' => $schedule]); + return $schedule->execute(); + } }); $this->commands([ diff --git a/src/Http/Services/CommandService.php b/src/Http/Services/CommandService.php index 2cd8fb7..c8839bc 100644 --- a/src/Http/Services/CommandService.php +++ b/src/Http/Services/CommandService.php @@ -2,14 +2,14 @@ namespace RobersonFaria\DatabaseSchedule\Http\Services; -use App\Console\Kernel; +use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Collection; class CommandService { public function get(): Collection { - $commands = collect(app(Kernel::class)->all())->sortKeys(); + $commands = collect(Artisan::all())->sortKeys(); $commandsKeys = $commands->keys()->toArray(); foreach (config('database-schedule.commands.exclude') as $exclude) { $commandsKeys = preg_grep("/^$exclude/", $commandsKeys, PREG_GREP_INVERT);