Skip to content

Commit

Permalink
Prevent table not found exception
Browse files Browse the repository at this point in the history
The try and catch blocks in this code snippet are used for exception handling
  • Loading branch information
a21ns1g4ts authored Aug 2, 2023
1 parent 8880066 commit 9caa178
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/FilamentDatabaseScheduleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ public function boot()
$model = $config->get('filament-database-schedule.model');
$model::observe(ScheduleObserver::class);

if (Schema::hasTable($config->get('filament-database-schedule.table.schedules', 'schedules'))) {
$this->app->resolving(BaseSchedule::class, function ($schedule) {
$schedule = app(Schedule::class, ['schedule' => $schedule]);
return $schedule->execute();
});
}
try {
if (Schema::hasTable($config->get('filament-database-schedule.table.schedules', 'schedules'))) {
$this->app->resolving(BaseSchedule::class, function ($schedule) {
$schedule = app(Schedule::class, ['schedule' => $schedule]);
return $schedule->execute();
});
}
} catch (\Exception $e) {}

$this->commands([
TestJobCommand::class,
Expand Down

0 comments on commit 9caa178

Please sign in to comment.