Fix loadning problematic routes in console mode + Fix SLide factory depending on route

This commit is contained in:
Jérémy Munsch 2024-03-29 12:27:37 +01:00
parent b202ea86f9
commit 434de3adc5
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
2 changed files with 56 additions and 54 deletions

View file

@ -33,7 +33,7 @@ class SlideFactory extends Factory
'title' => $this->faker->unique()->word(),
'text' => $this->faker->realText(25),
'link_label' => $this->faker->text(128),
'link' => route('wasup'),
'link' => 'route(\'wasup\')',
'link_new_tab' => rand(0, 1),
'date_start' => Carbon::now(),
'date_end' => Carbon::now()->addDays(2),

View file

@ -114,58 +114,60 @@ Route::prefix('bo')
}
);
$langs = ['en', 'es', ''];
if(!app()->runningInConsole()) {
$langs = ['en', 'es', ''];
foreach ($langs as $lang) {
Route::middleware(['front-end-globals'])
->prefix($lang)
->name($lang == '' ? '' : $lang . '.')
->group(
function () use ($lang) {
Route::get('/', [ControllersHomeController::class, 'index'])->name('home');
foreach ($langs as $lang) {
Route::middleware(['front-end-globals'])
->prefix($lang)
->name($lang == '' ? '' : $lang . '.')
->group(
function () use ($lang) {
Route::get('/', [ControllersHomeController::class, 'index'])->name('home');
Route::get(
'/' . Str::slug(Lang::get('urls.marque', [], $lang)),
[ControllersMarqueController::class, 'index']
)->name('wasup');
Route::get(
'/' . Str::slug(Lang::get('urls.gammes', [], $lang)),
[ControllersGammesController::class, 'index']
)->name('gammes.index');
Route::get(
'/' . Str::slug(Lang::get('urls.gamme', [], $lang)) . '/{gammeSlug:slug}',
[ControllersGammesController::class, 'show']
)->name('gammes.show');
Route::get(
'/' . Str::slug(Lang::get('urls.produit', [], $lang)) . '/{gammeSlug:slug}/{productSlug:slug}',
[ControllersProductsController::class, 'show']
)->name('product.show');
Route::get(
'/' . Str::slug(Lang::get('urls.news', [], $lang)),
[ControllersNewsController::class, 'index']
)->name('news');
Route::get(
'/' . Str::slug(Lang::get('urls.food-service', [], $lang)),
[ControllersFoodServiceController::class, 'index']
)->name('food');
Route::get(
'/' . Str::slug(Lang::get('urls.legals', [], $lang)),
[ControllersLegalsController::class, 'index']
)->name('cgu');
Route::get(
'/' . Str::slug(Lang::get('urls.policy', [], $lang)),
[ControllersPolicyController::class, 'index']
)->name('policy');
Route::get(
'/' . Str::slug(Lang::get('urls.search', [], $lang)),
[ControllersProductsController::class, 'search']
)->name('search');
// Classic.
Route::get(
'/' . Str::slug(Lang::get('urls.contact', [], $lang)),
[ControllersContactController::class, 'contact']
)->name('contact');
Route::post('/contact', [ControllersContactController::class, 'contactSubmit'])->name('contact.submit');
}
);
}//end foreach
Route::get(
'/' . Str::slug(Lang::get('urls.marque', [], $lang)),
[ControllersMarqueController::class, 'index']
)->name('wasup');
Route::get(
'/' . Str::slug(Lang::get('urls.gammes', [], $lang)),
[ControllersGammesController::class, 'index']
)->name('gammes.index');
Route::get(
'/' . Str::slug(Lang::get('urls.gamme', [], $lang)) . '/{gammeSlug:slug}',
[ControllersGammesController::class, 'show']
)->name('gammes.show');
Route::get(
'/' . Str::slug(Lang::get('urls.produit', [], $lang)) . '/{gammeSlug:slug}/{productSlug:slug}',
[ControllersProductsController::class, 'show']
)->name('product.show');
Route::get(
'/' . Str::slug(Lang::get('urls.news', [], $lang)),
[ControllersNewsController::class, 'index']
)->name('news');
Route::get(
'/' . Str::slug(Lang::get('urls.food-service', [], $lang)),
[ControllersFoodServiceController::class, 'index']
)->name('food');
Route::get(
'/' . Str::slug(Lang::get('urls.legals', [], $lang)),
[ControllersLegalsController::class, 'index']
)->name('cgu');
Route::get(
'/' . Str::slug(Lang::get('urls.policy', [], $lang)),
[ControllersPolicyController::class, 'index']
)->name('policy');
Route::get(
'/' . Str::slug(Lang::get('urls.search', [], $lang)),
[ControllersProductsController::class, 'search']
)->name('search');
// Classic.
Route::get(
'/' . Str::slug(Lang::get('urls.contact', [], $lang)),
[ControllersContactController::class, 'contact']
)->name('contact');
Route::post('/contact', [ControllersContactController::class, 'contactSubmit'])->name('contact.submit');
}
);
}//end foreach
}