Git Product home page Git Product logo

Comments (8)

inmanturbo avatar inmanturbo commented on June 9, 2024 1

@jeffturcotte I use this for working with HTMX https://github.com/inmanturbo/turbohx/blob/main/src/TurboHX.php

You can install it with composer require inmanturbo/turbohx
no docs or readme yet but I suppose I'll get around to it if others are going to use it. PR's welcome.

from folio.

crynobone avatar crynobone commented on June 9, 2024

It doesn't make sense to have "views" for POST, PUT, and DELETE, as it should handle form requests and redirect/throw errors.

from folio.

driesvints avatar driesvints commented on June 9, 2024

I don't think it was ever intended for Folio to have routes other than GET, sorry.

from folio.

devajmeireles avatar devajmeireles commented on June 9, 2024

I don't think it was ever intended for Folio to have routes other than GET, sorry.

So this should at least be documented? We need to care about new users too.

Why will the "Controller" class be kept even though it is apparently useless? To guide new users perhaps? It's the same reasoning.

from folio.

inmanturbo avatar inmanturbo commented on June 9, 2024

If you just want to eliminate the need for controllers and/or route entries altogether, you can use https://github.com/livewire/volt together with folio to handle CRUD functionality from right within your views

from folio.

jeffturcotte avatar jeffturcotte commented on June 9, 2024

Can this be reconsidered?

In a situation where you are using HTMX or similar client library, it is not uncommon to have all methods GET/PUT/POST/DELETE returning HTML to swap into the dom. It would be amazing and incredibly convenient to be able to use Folio's page-based routing in such scenarios. I don't see why the limitation is needed here and seems to just have been inherited because (I believe) the standard Route::fallback handler is used. Traditional "page-based routing", where you'd throw a bunch of PHP files into a directory, worked with every method. :)

Ideally, there'd be a way to configure this via the ServiceProvider for a given folio path. I'm not advocating for the filename based solution in the original post.

From the HTMX docs:

Submitting a form via htmx has the benefit of no longer needing the Post/Redirect/Get Pattern. After successfully processing a POST request on the server, you don’t need to return a HTTP 302 (Redirect). You can directly return the new HTML fragment.

Thanks!

from folio.

jeffturcotte avatar jeffturcotte commented on June 9, 2024

Thanks @inmanturbo! My comment still stands, but I'll take a look at your package. πŸ‘ :)

from folio.

inmanturbo avatar inmanturbo commented on June 9, 2024

@jeffturcotte It depends on Folio, binds another manager and brings in all methods. Also a few matchers for catching many routes in a single file as described in this pr: #119

from folio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.