From 866eee5b1608154158a0eb92eb7f57716091e317 Mon Sep 17 00:00:00 2001 From: Jonatan Rek Date: Tue, 6 Aug 2024 16:20:45 +0200 Subject: [PATCH] Fixes --- database/seeders/DatabaseSeeder.php | 12 ++++++-- database/seeders/HostSeeder.php | 22 ++++++++++++++ database/seeders/TaskSeeder.php | 23 +++++++++++++++ .../maintenance/planned-detail.blade.php | 29 ++++++++++--------- routes/console.php | 10 +++++-- 5 files changed, 77 insertions(+), 19 deletions(-) create mode 100644 database/seeders/HostSeeder.php create mode 100644 database/seeders/TaskSeeder.php diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index d01a0ef..4ed2b6d 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -14,10 +14,16 @@ class DatabaseSeeder extends Seeder public function run(): void { // User::factory(10)->create(); + if (empty(User::where('email', 'test@example.co')->first())){ + User::factory()->create([ + 'name' => 'Test User', + 'email' => 'test@example.com', + ]); + } - User::factory()->create([ - 'name' => 'Test User', - 'email' => 'test@example.com', + $this->call([ + HostSeeder::class, + TaskSeeder::class, ]); } } diff --git a/database/seeders/HostSeeder.php b/database/seeders/HostSeeder.php new file mode 100644 index 0000000..8308b24 --- /dev/null +++ b/database/seeders/HostSeeder.php @@ -0,0 +1,22 @@ + $hostname, + ]); + } + } +} diff --git a/database/seeders/TaskSeeder.php b/database/seeders/TaskSeeder.php new file mode 100644 index 0000000..bca4718 --- /dev/null +++ b/database/seeders/TaskSeeder.php @@ -0,0 +1,23 @@ + $name, + 'description' => $name, + ]); + } + } +} diff --git a/resources/views/maintenance/planned-detail.blade.php b/resources/views/maintenance/planned-detail.blade.php index 53f82e6..f94c659 100644 --- a/resources/views/maintenance/planned-detail.blade.php +++ b/resources/views/maintenance/planned-detail.blade.php @@ -4,20 +4,23 @@

{{ __('Planned Maintenance') }}

{!! $maintenance_history->maintenance->description !!}

- @foreach ($maintenance_history->historyHosts as $historyHost) -
-
- {{ $historyHost->host->hostname }} -
-
-
- @foreach ($historyHost->historyTasks as $historyTasks) - - {!! $historyTasks->maintenanceTask->task->description !!} - @endforeach + + @foreach ($maintenance_history->historyHosts as $historyHost) +
+
+ {{ $historyHost->host->hostname }} +
+
+
+ @foreach ($historyHost->historyTasks as $historyTasks) + +

{!! $historyTasks->maintenanceTask->task->description !!}

+ @endforeach +
-
- @endforeach + @endforeach + {{ __('Ukončit')}} +
\ No newline at end of file diff --git a/routes/console.php b/routes/console.php index eff2ed2..9907e34 100644 --- a/routes/console.php +++ b/routes/console.php @@ -1,8 +1,12 @@ comment(Inspiring::quote()); -})->purpose('Display an inspiring quote')->hourly(); +// Artisan::command('inspire', function () { +// $this->comment(Inspiring::quote()); +// })->purpose('Display an inspiring quote')->hourly(); + +Schedule::job(new ScheduleNextMaintenance())->daily()->withoutOverlapping(); \ No newline at end of file