This commit is contained in:
Jonatan Rek 2024-08-06 16:20:45 +02:00
parent ecb255fc6a
commit 866eee5b16
5 changed files with 77 additions and 19 deletions

View File

@ -14,10 +14,16 @@ class DatabaseSeeder extends Seeder
public function run(): void public function run(): void
{ {
// User::factory(10)->create(); // User::factory(10)->create();
if (empty(User::where('email', 'test@example.co')->first())){
User::factory()->create([ User::factory()->create([
'name' => 'Test User', 'name' => 'Test User',
'email' => 'test@example.com', 'email' => 'test@example.com',
]); ]);
} }
$this->call([
HostSeeder::class,
TaskSeeder::class,
]);
}
} }

View File

@ -0,0 +1,22 @@
<?php
namespace Database\Seeders;
use App\Models\Host;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class HostSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
foreach (['IT-PRG-DOCKER', 'IT-PRG-DOCKER02', 'CK-PRG-DOCKER01'] as $hostname) {
Host::create([
'hostname' => $hostname,
]);
}
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use App\Models\Task;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class TaskSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
foreach (['Update Zabbixu', 'Instalace Aktualizací', 'Kontrola Logu'] as $name) {
Task::create([
'name' => $name,
'description' => $name,
]);
}
}
}

View File

@ -4,6 +4,7 @@
<h1>{{ __('Planned Maintenance') }}</h1> <h1>{{ __('Planned Maintenance') }}</h1>
</div> </div>
<p>{!! $maintenance_history->maintenance->description !!}</p> <p>{!! $maintenance_history->maintenance->description !!}</p>
<x-form::form action="save" method="PUT">
@foreach ($maintenance_history->historyHosts as $historyHost) @foreach ($maintenance_history->historyHosts as $historyHost)
<div class="mb-3"> <div class="mb-3">
<div class="btn-toggle btn py-3 w-100 bg-primary text-start" style="--bs-bg-opacity: .2;" data-bs-toggle="collapse" data-bs-target="#collapse{{ $historyHost->id }}"> <div class="btn-toggle btn py-3 w-100 bg-primary text-start" style="--bs-bg-opacity: .2;" data-bs-toggle="collapse" data-bs-target="#collapse{{ $historyHost->id }}">
@ -13,11 +14,13 @@
<div class="card card-body mt-2"> <div class="card card-body mt-2">
@foreach ($historyHost->historyTasks as $historyTasks) @foreach ($historyHost->historyTasks as $historyTasks)
<x-form::checkbox wire:model="test" label="{{$historyTasks->maintenanceTask->task->name}}" /> <x-form::checkbox wire:model="test" label="{{$historyTasks->maintenanceTask->task->name}}" />
{!! $historyTasks->maintenanceTask->task->description !!} <p>{!! $historyTasks->maintenanceTask->task->description !!}</p>
@endforeach @endforeach
</div> </div>
</div> </div>
</div> </div>
@endforeach @endforeach
<x-form::button class="btn-primary" type="submit">{{ __('Ukončit')}}</x-form::button>
</x-form::form>
</div> </div>
</x-layout-app> </x-layout-app>

View File

@ -1,8 +1,12 @@
<?php <?php
use App\Jobs\ScheduleNextMaintenance;
use Illuminate\Foundation\Inspiring; use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
Artisan::command('inspire', function () { // Artisan::command('inspire', function () {
$this->comment(Inspiring::quote()); // $this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote')->hourly(); // })->purpose('Display an inspiring quote')->hourly();
Schedule::job(new ScheduleNextMaintenance())->daily()->withoutOverlapping();