69 lines
2.4 KiB
PHP
69 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\IntegrationTemplate;
|
|
use App\Models\Service;
|
|
use App\Models\TemplateServiceItem;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class IntegrationTemplateSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$template = IntegrationTemplate::firstOrCreate([
|
|
'name' => 'Agent Standard',
|
|
'is_active' => true,
|
|
]);
|
|
|
|
$services = Service::all();
|
|
|
|
foreach ($services as $service) {
|
|
if ($service->name === 'DSI') {
|
|
$template->serviceItems()->create([
|
|
'service_id' => $service->id,
|
|
'label' => 'Création compte AD',
|
|
'is_mandatory' => true,
|
|
]);
|
|
$template->serviceItems()->create([
|
|
'service_id' => $service->id,
|
|
'label' => 'Attribution Ordinateur',
|
|
'is_mandatory' => true,
|
|
]);
|
|
$template->serviceItems()->create([
|
|
'service_id' => $service->id,
|
|
'label' => 'Création email',
|
|
'is_mandatory' => true,
|
|
]);
|
|
$template->serviceItems()->create([
|
|
'service_id' => $service->id,
|
|
'label' => 'Affectation Téléphonie Fixe',
|
|
'is_mandatory' => false,
|
|
]);
|
|
$template->serviceItems()->create([
|
|
'service_id' => $service->id,
|
|
'label' => 'Affectation Téléphone mobile',
|
|
'is_mandatory' => false,
|
|
]);
|
|
$template->serviceItems()->create([
|
|
'service_id' => $service->id,
|
|
'label' => 'Accès au SIG',
|
|
'is_mandatory' => false,
|
|
]);
|
|
} elseif ($service->name === 'Batiment') {
|
|
$template->serviceItems()->create([
|
|
'service_id' => $service->id,
|
|
'label' => 'Attribution Badge',
|
|
'is_mandatory' => true,
|
|
]);
|
|
} elseif ($service->name === 'ParcAuto') {
|
|
$template->serviceItems()->create([
|
|
'service_id' => $service->id,
|
|
'label' => 'Création compte vehicule',
|
|
'is_mandatory' => false,
|
|
]);
|
|
}
|
|
}
|
|
}
|
|
}
|