Comments (9)
@sahnb About the problem you are having:
<x-splade-form action="..." method="put">...</x-splade-form>
This does translate to:
<form action="..." method="PUT">...</form>
but this is incorrect, because the method can only be GET
or POST
you would instead need to do the following:
<x-splade-form action="..." method="POST">
@method('PUT')
...
</x-splade-form>
Which translates to
<form action="..." method="POST">
<input type="hidden" name="_method" value="PUT" />
...
</form>
See https://stackoverflow.com/questions/8054165/using-put-method-in-html-form
from laravel-splade.
@Jubeki Splade's Form component does that for you. You don't have to manually use the @method
directive or a hidden input field.
from laravel-splade.
Whoops, I made a wrong assumption. It's fixed in v0.6.1 and I also added a test for it :)
from laravel-splade.
My apologies, apparently my package.json was running behind having "@protonemedia/laravel-splade": "^0.5.0" instead of "0.6.0". I did update with composer but not the npm-packages.
I installed a fresh Laravel application with the latest protonemedia/laravel-splade-breeze, placed my models, views and controllers in it and now it's working like a charm.
This fixes #102 as well.
from laravel-splade.
need to define update route separately.
**
from laravel-splade.
I am getting the same issue @pascalbaljet can you give an example?
I have the exact same markup as the OP, using <x-splade-form .. method="PUT">
and then the request body is just empty when I dump it in the controller, as HTML forms support only GET and POST methods.
Any advice would be appreciated.
from laravel-splade.
Solved it by adding
@if(isset($data['id']))
<x-splade-input name="id" type="hidden"/>
<x-splade-input name="_method" type="hidden"/>
@endif
And providing ['_method' => 'PUT', .... ]
along with the data.
from laravel-splade.
At first, thanks Pascal for your amazing work, Splade is exactly what is was looking for for years!
Unfortunately an issue related to described above seems to be still there for PUT/PATCH requests, at least in my tests.
I'm using Splade 0.6.13 (with protonemedia/laravel-splade-breeze) / Laravel 9.38.0 / PHP 8.0.22
POST-requests for creating are working just fine, but when I do an PUT or PATCH request (with <x-splade-form method="patch" action="...
) the post-data is empty. In the network-tab I do see there was a PUT/PATCH-request.
When I remove the method="patch"
and add an extra route like Route::post('/test/{item}', [...Controller::class, 'update'])->name('test');
and use this for the action, the POST-data is there.
from laravel-splade.
make sure your package updated ,
from laravel-splade.
Related Issues (20)
- Not Fetching default Select value from record on Edit HOT 1
- When will be laravel-Splade v2 released HOT 7
- Collapse sidebar function
- Date Range Filter Table Splade HOT 1
- Filepond multiple upload with Spatie media library keeps only the first file HOT 2
- Dynamically added fields to a Splade form not being submitted
- Laravel support for presence channels
- PersistenLayout Not Working HOT 3
- Component Specific Javascript Dependencies HOT 3
- How to user ChartJS with Splade? HOT 1
- <x-splade-input> value tag will be ignored and is empty HOT 1
- X-Splade-Rehydrate loads the wrong part
- Set specific date range in x-splade-input with flatpickr HOT 2
- The script is not working until I reload the page HOT 1
- Question: How to use route method in remote-url option of x-splade-select HOT 1
- x-splade-flash doesn't show Flash-Data HOT 1
- uploading multiple files to an empty spatie media collection only stores the last file in the array. HOT 1
- [Feature request] New tab option for the <link> component
- Text in Toast has a margin top
- Feature request or help needed for modal close confirmation popup
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 laravel-splade.