chinleung / laravel-multilingual-routes

A package to handle multilingual routes in your Laravel application.
https://github.com/chinleung/laravel-multilingual-routes-demo
MIT License
394 stars 26 forks source link

Fix issue that causes routes grouped with prefix to generate 404. #59

Closed AbdullahFaqeir closed 2 years ago

AbdullahFaqeir commented 2 years ago

Issue Reference

50

Description

When multilingual route(s) is/are defined in a prefixed group, the routes generates 404 pages.

How To Test This?


<?php

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('welcome');
});

Route::group(['prefix' => 'blog'], function () {
    $c = App\Http\Controllers\BlogController::class;

    Route::multilingual('/', [$c, 'index'])->name('blog.index');
    Route::multilingual('/create', [$c, 'create'])->name('blog.create');
    Route::multilingual('/edit/{post}', [$c, 'edit'])->name('blog.edit');
    Route::multilingual('/show/{post}', [$c, 'show'])->name('blog.show');
});

Then navigate to /blog

Extra Details

Only the root route "/" generates 404, whilst other routes with extra uri parts works just fine.

Documentation

AbdullahFaqeir commented 2 years ago

Hi @chinleung!

Can you please check and review the PR?

chinleung commented 2 years ago

Thanks @AbdullahFaqeir!

AbdullahFaqeir commented 2 years ago

@chinleung You're most welcome, and I'm more than happy to help anytime in the future, just ping.

AbdullahFaqeir commented 2 years ago

Hey @chinleung!

Can you please add 'hacktoberfest' to the repo's topics