laravel / folio

Page based routing for Laravel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Folio Route Fallback

devajmeireles opened this issue · comments

commented

Reason

I'm building an app that will use Folio and Volt. Because this app does not have an API, I removed the RouteServiceProvider as I think this is unnecessary for this app. By removing the RouteServiceProvider, I lost the ability to create a fallback router, and that caused me to open this feature request.

As Folio's proposal is to offer routes based on files, there are scenarios like this one where we are creating a simple website that doesn't require routes to be created via routes/web.php - also because it loses the sense of using Folio, I believe that it is extremely necessary to create a way to define a fallback - a Folio file that, when it exists, receives all requests that don't match any other Folio route. When the file does not exist, we can then allow a 404 status.

Proposal

The fallback route can match: [].blade.php

Discovery

An ErrorException is thrown when there is a file like pages/[].blade.php at the root of the project. Perhaps the Folio is one step closer to allowing fallback? 🤔

CleanShot 2023-08-26 at 7 34 48

Final Words

"Why not only restore RouteServiceProvider to create a route by routes/web.php?"

  • As mentioned above, if Folio's proposal is to offer routes based on files, I think we can have this type of control without depending on the RouteServiceProvider and default routes for that.

Hey there, thanks for reporting this issue.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?

Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

commented

Hey, @crynobone ! Thanks for your reply.

Steps to reproduce the issue:

  • Initialize new Laravel app in latest version
  • Install Folio
  • Run this command: php artisan make:folio "[slug]"
  • Run this command: php artisan make:folio "[]"
  • Try to access the http://your-app-url.com/fake-slug 👈🏻 The mentioned error will happen.

According to your request, this is the repository: https://github.com/devajmeireles/laravel-bug-report

Commit: "[4cbeefa] reproducing bug"

@crynobone I guess this is more a feature request.

commented

@crynobone I guess this is more a feature request.

Clearly there is a reported bug, or is what I said not a bug? 🤔

I don't think we support [].blade.php right now? Can you point out in the docs where we document that?

commented

I don't think we support [].blade.php right now? Can you point out in the docs where we document that?

Who said I said this is supported? I opened it as a feature request and as a discovery, I mentioned that an error is thrown when trying to use a [].blade.php file, so I JUST mentioned that maybe we were one step away from supporting a fallback. Sorry, but did you really read it? Clearly, this is a bug and deserves attention.

I don't believe this is a bug, as there's no where documented about having a fallback or [].blade.php is even valid. What's tripped me initially and the reason why I asked for reproducing repository is that you mention the issue started because you removed RouteServiceProvider and clearly we need more information to justify whether this is a bug.

I'm confused lol. In one post you say you're reporting a bug, in another you're saying you're submitting a feature request. Which one is it now? 😅