404 | NOT FOUND
Hello Bobby
Blog shows 404 | NOT FOUND when executing the following commands: php artisan route:clear or php artisan optimize:clear. The error is when clicking categories or articles.
I don't know the implication of these commands to the fullest but between coding, browsing, testing and terminal commands, it get confusing to see a 404. Would be possible to avoid the error by doing some wave/blog fixing?
Note: The 404 doesn't write in storage/log/laravel.log.
I'm using Wampserver 3.2.6 - 64bit, Apache 2.4.51, PHP 8.1, MySQL 5.7.36, MariaDB 10.6.5.
Thank you in advance
Hi there,
I've just tested this and it seems like that the problem is caused by the riari/laravel-forum
package that you are using. If you try that out with a fresh new Wave installation without the forum package, it works as expected.
Somehow the riari/laravel-forum
package is messing up with the Wave category routes category routes:
From the screenshot you can see that the wave blog category route is actually looking for a category under the forum package table. In the vendor/riari/laravel-forum/routes/web.php
file the following route binding is causing the problem:
Route::bind('category', function ($value) {
return \TeamTeaTime\Forum\Models\Category::findOrFail($value);
});
The two packages seem to be a bit incompatible, I'm not familiar with that forum package so maybe it is best to use a different forum package, or bring that up as an issue on their end so they might be able to patch it. Otherwise you should not make direct edits in the vendor
directory as those changes will be overriten on the next composer update/install
.
Similar to what we did for the themes package, where we submitted a PR with that change directly to the package repo itself.
Let me know how it goes!
Bobby
The short story: Laravel-forum merged changes. Could you try another installation to see what you can find? I did it but the error persist.
Bit of more info: Laravel-forum merged pull request #320 due to the 7 cache issues that I reported. Actually, now the Web.php line that you mentioned isn't there anymore but the error persist in blog.
For more detail, please visit the following links:
-
https://github.com/Team-Tea-Time/laravel-forum/pull/320
-
https://github.com/Team-Tea-Time/laravel-forum/issues?q=is%3Aissue+is%3Aclosed+author%3ACyberEkklesiaOwner
P.S: I also told them about this post: https://github.com/Team-Tea-Time/laravel-forum/issues/321
Update: Here is riari's response.
"I can immediately see what the problem is. Unfortunately, the route model binding feature in Laravel doesn't provide a way of scoping binding logic to specific route groups or prefixes. This is actually a problem for the package itself too, because both the API and web routes use the same set of route model parameters with slightly different logic - so there's a conflict between the bindings for each.
I was considering creating a feature PR for Laravel to introduce some kind of scoping capability to route bindings for this reason, but a simpler solution for now would be to rename the route parameters to something that's more unique to the package. I'll probably prefix them with lf_ or something.
I'll work on a new release with that fix tonight and let you know when it's done."
Bobby, I will let you know the results. Thank you for your support.
















Hi there,
Really happy to see that the package has a great dev team! If they could come up with the fix for the route binding problem that would be awesome.
I've done some research and this package seems to be one of the best forum packages that I could find so it will be great if we could make it work with Wave.
In the past we used to have a forum package called Chatter but we no longer support it.
Fingers crossed and keep me posted!
















Good news! Riari worked with binding situation. About the fix, he explained: "It moves the binding logic into middleware. Works with the router cache, prevents conflicts...". I just updated the package and worked like a charm.
- Composer Update
- php artisan optimize:clear
- php artisan optimize
Your previous fixes and riari's fixes, turns out to be perfect!
As of today, laravel-forum works with Wave. If a list of compatible packages is ever considered here is one: https://github.com/Team-Tea-Time/laravel-forum
Thank you Bobby for your help.
















That is great! Happy to hear that it is all working now! Huge thanks to Riari 🙌