ldc-agis/database/seeders/StaticPageSeeder.php
Jérémy Munsch 4e596fb2b9
Closes #76
2024-03-20 13:54:37 +01:00

155 lines
6.1 KiB
PHP

<?php
namespace Database\Seeders;
use App\Enums\StaticPageType;
use App\Models\StaticPage;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;
class StaticPageSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
try {
StaticPage::unsetEventDispatcher();
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::contact,
],
[
'seo_title' => 'Seo title pour la page contactez nous',
'seo_description' => 'Seo description pour la page contactez nous',
'title' => 'Contactez-nous',
'slug' => Str::slug('Contactez-nous'),
'type' => StaticPageType::contact,
'content' => '',
]
);
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::legals,
],
[
'seo_title' => 'Seo title pour la page mentions légales et CGU',
'seo_description' => 'Seo description pour la page mentions légales et CGU',
'title' => 'Mentions légales et CGU',
'slug' => Str::slug('Mentions légales et CGU'),
'type' => StaticPageType::legals,
'content' => \clean(\fake()->randomHtml(6, 7)),
]
);
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::confidentiality,
],
[
'seo_title' => 'Seo title pour la page charte de confidentialitée',
'seo_description' => 'Seo description pour la page charte de confidentialitée',
'title' => 'Charte de confidentialitée',
'slug' => Str::slug('Charte de confidentialitée'),
'type' => StaticPageType::confidentiality,
'content' => \clean(\fake()->randomHtml(6, 7)),
]
);
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::home,
],
[
'seo_title' => 'Seo title pour la page d\'accueil',
'seo_description' => 'Seo description pour la page d\'accueil',
'title' => 'Accueil',
'slug' => Str::slug('Accueil'),
'type' => StaticPageType::home,
'content' => '',
]
);
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::conviction,
],
[
'seo_title' => 'Seo title pour la page Nos Convictions',
'seo_description' => 'Seo description pour la page Nos Convictions',
'title' => 'Nos Convictions',
'slug' => Str::slug('Nos Convictions'),
'type' => StaticPageType::conviction,
'content' => '',
]
);
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::explorer,
],
[
'seo_title' => 'Seo title pour la page Explorateur & Gastronome',
'seo_description' => 'Seo description pour la page Explorateur & Gastronome',
'title' => 'L\'Explorateur & Gastronome',
'slug' => Str::slug('Explorateur & Gastronome'),
'type' => StaticPageType::explorer,
'content' => '',
]
);
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::joinus,
],
[
'seo_title' => 'Seo title pour la page Rejoignez-nous',
'seo_description' => 'Seo description pour la page Rejoignez-nous',
'title' => 'Rejoignez-nous',
'slug' => Str::slug('Rejoignez-nous'),
'type' => StaticPageType::joinus,
'content' => '',
]
);
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::ranges,
],
[
'seo_title' => 'Seo title pour la page Nos Gammes de Produits',
'seo_description' => 'Seo description pour la page Nos Gammes de Produits',
'title' => 'Nos Gammes de Produits',
'slug' => Str::slug('Nos Gammes de Produits'),
'type' => StaticPageType::ranges,
'content' => '',
]
);
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::aboutus,
],
[
'seo_title' => 'Seo title pour la page Nous Connaître',
'seo_description' => 'Seo description pour la page Nous Connaître',
'title' => 'Nous Connaître',
'slug' => Str::slug('Nous Connaître'),
'type' => StaticPageType::aboutus,
'content' => '',
]
);
StaticPage::query()->updateOrCreate(
[
'type' => StaticPageType::news,
],
[
'seo_title' => 'Seo title pour la page Actualités',
'seo_description' => 'Seo description pour la page Actualités',
'title' => 'Actualités',
'slug' => Str::slug('Actualités'),
'type' => StaticPageType::news,
'content' => '',
]
);
} finally {
StaticPage::setEventDispatcher(new \Illuminate\Events\Dispatcher());
} //end try
}
}