Comments (6)
Sorry, but this isn't possible. Currently, and I do it frequently, one can use the same route name on two different HTTP methods. Thus, it's not possible to determine, with adequate certainty, which verb to use.
Close
Sent from my iPhone
On Sep 13, 2015, at 4:35 PM, Brett Taylor [email protected] wrote:
If I have the route:
Route::put('cart/add', ['as' => 'cart.add', 'uses' => 'CartController@addProduct']);
and in a view I have:{!! Form::open(['route' => 'cart.add', 'class' => 'form-horizontal']) !!}
But it does not create the _method hidden field. It should detect that the route is a PUT, and automatically output the _method hidden field.
I expect the output:Backwards compatibility shouldn't be an issue, as if people have named routes that aren't POST they're already creating their own _method field which will override the one Form::open would create.
Is this something that would be accepted as a pull request?
—
Reply to this email directly or view it on GitHub.
from html.
You use the same route name on two different methods: Are you sure you don't mean the URI fragments? It seems weird to have two named routes with the same name: what's the point?
from html.
Yes, I mean the same route name. I use the HTTP verb to differentiate. Whether you use this strategy or not, it's still impossible to ensure that it would resolve correctly.
Sent from my iPhone
On Sep 13, 2015, at 4:46 PM, Brett Taylor [email protected] wrote:
You use the same route name on two different methods: Are you sure you don't mean the URI fragments? It seems weird to have two named routes with the same name: what's the point?
—
Reply to this email directly or view it on GitHub.
from html.
Okay, thanks. Glad I asked before writing a PR :)
from html.
I appreciate the effort, though! Thanks for contributing. :)
from html.
Maybe I could clarify this in the documentation? Something along the lines of:
When using named routes be aware that Form::open will not inspect the route to determine the route's method. Be sure to specify the method yourself.
from html.
Related Issues (20)
- Site
- Active fork
- Html
- <!DOCTYPE html> <html> <head> <title>Parcel Sandbox</title> <meta charset="UTF-8" /> </head> <body> <canvas id="canvas"></canvas> <script src="./index.js" type="module"></script> </body> </html>
- Html
- My html project
- Html
- Sf
- Html
- Laravel 11 Compatible Fork Is Here [INFO] HOT 5
- Flexiwork
- Teste1
- Nelzy Webpage Simple
- Html
- G
- Portfolio
- Dg
- Carta
- Project
- Laravel 11 php 8.2 not working. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html.