Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefixed route results in 404 #50

Closed
MarcelWeidum opened this issue May 5, 2021 · 13 comments
Closed

Prefixed route results in 404 #50

MarcelWeidum opened this issue May 5, 2021 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@MarcelWeidum
Copy link

Describe the bug

When I group a route and prefix it, it throws a 404.

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'routes/web.php'
  2. Make a grouped route
  3. Make a child route in the grouped route
  4. Navigate to child route
  5. See error

Expected behavior

Run controller method.

Result of route:list:

+--------+----------+----------------------------------+-----------------------+------------------------------------------------------+---------------+
| Domain | Method   | URI                              | Name                  | Action                                               | Middleware    |
+--------+----------+----------------------------------+-----------------------+------------------------------------------------------+---------------+
|        | GET|HEAD | /                                |                       | Closure                                              | web           |
|        | GET|HEAD | api/user                         |                       | Closure                                              | api           |
|        |          |                                  |                       |                                                      | auth:api      |
|        | GET|HEAD | blog/                            | en.blog.index         | App\Http\Controllers\BlogController@index            | web           |
|        | GET|HEAD | blog/create                      | en.blog.create        | App\Http\Controllers\BlogController@create           | web           |
|        | GET|HEAD | blog/edit/{post}                 | en.blog.edit          | App\Http\Controllers\BlogController@edit             | web           |
|        | GET|HEAD | blog/show/{post}                 | en.blog.show          | App\Http\Controllers\BlogController@show             | web           |
|        | GET|HEAD | livewire/livewire.js             |                       | Livewire\Controllers\LivewireJavaScriptAssets@source |               |
|        | GET|HEAD | livewire/livewire.js.map         |                       | Livewire\Controllers\LivewireJavaScriptAssets@maps   |               |
|        | POST     | livewire/message/{name}          | livewire.message      | Livewire\Controllers\HttpConnectionHandler           | web           |
|        | GET|HEAD | livewire/preview-file/{filename} | livewire.preview-file | Livewire\Controllers\FilePreviewHandler@handle       | web           |
|        | POST     | livewire/upload-file             | livewire.upload-file  | Livewire\Controllers\FileUploadHandler@handle        | web           |
|        |          |                                  |                       |                                                      | throttle:60,1 |
+--------+----------+----------------------------------+-----------------------+------------------------------------------------------+---------------+

My routes/web.php:

<?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');
});

If I navigate to /blog it throws a 404. And if I change the child route to get it works:

Route::get('/', [$c, 'index'])->name('blog.index');
@MarcelWeidum MarcelWeidum added the bug Something isn't working label May 5, 2021
@chinleung chinleung self-assigned this May 5, 2021
@chinleung
Copy link
Owner

@MarcelWeidum Just wanted to let you know that I've been able to reproduce the error. I'll be having a look on what's causing this and publish a fix.

@MarcelWeidum
Copy link
Author

@chinleung great thank you 🤩

@AbdullahFaqeir
Copy link
Contributor

Is this issue still presented?

@MarcelWeidum
Copy link
Author

@AbdullahFaqeir yes, never fixed

@AbdullahFaqeir
Copy link
Contributor

If the package maintainer can check my PR the soonest, I'd submit a PR fixing this within 2-3 hours.

@chinleung
Copy link
Owner

@MarcelWeidum Sorry, I totally forgot about this issue!

@AbdullahFaqeir Can you please submit a pull request? I'll review it right after.

@AbdullahFaqeir
Copy link
Contributor

Hello @chinleung,

Sure I will, I'm currently working on another PR, I'll instantly move to it once I submit the PR I'm working on it, I need like 2 hours.

@chinleung
Copy link
Owner

@MarcelWeidum This is fixed in v2.7.5. 😄

@AbdullahFaqeir
Copy link
Contributor

@chinleung can you please add hacktoberfest to the topics of the repo?

@chinleung
Copy link
Owner

@chinleung can you please add hacktoberfest to the topics of the repo?

Hey @AbdullahFaqeir! I've added the topic. :)

@AbdullahFaqeir
Copy link
Contributor

@chinleung can you please add hacktoberfest to the topics of the repo?

Hey @AbdullahFaqeir! I've added the topic. :)

Thanks a lot <3

@AbdullahFaqeir
Copy link
Contributor

@chinleung can you please add hacktoberfest to the topics of the repo?

Hey @AbdullahFaqeir! I've added the topic. :)

Hey, I'm really sorry for the disturb ^^', but there's a typo in the repo's topic, it's "hacktoberfest" not "hactoberfest", there's a missing k hahahah

@chinleung
Copy link
Owner

Hey, I'm really sorry for the disturb ^^', but there's a typo in the repo's topic, it's "hacktoberfest" not "hactoberfest", there's a missing k hahahah

Oops, I've corrected it now. Sorry, added it from my mobile phone. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants