Various fixes for DB seeding

This commit is contained in:
2025-12-04 22:37:16 +01:00
parent 0200c38f30
commit b7a880d66a
12 changed files with 71 additions and 75 deletions
+6 -4
View File
@@ -3,9 +3,9 @@
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schedule;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Schema;
use Illuminate\Routing\Events\RouteMatched;
use App\Models\Setting;
use App\Listeners\ScheduleListener;
@@ -22,9 +22,11 @@ public function boot(): void
{
parent::boot();
$method = Setting::where('key', 'app.schedule_method')->value('value') ?? 'internal';
if ($method === 'internal') {
Event::listen(RouteMatched::class, [ScheduleListener::class, 'handle']);
if (Schema::hasTable('settings')) {
$method = Setting::where('key', 'app.schedule_method')->value('value') ?? 'internal';
if ($method === 'internal') {
Event::listen(RouteMatched::class, [ScheduleListener::class, 'handle']);
}
}
// TODO: read where to put these