GithubHelp home page GithubHelp logo

Comments (9)

Jubeki avatar Jubeki commented on May 18, 2024 1

@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.

pascalbaljet avatar pascalbaljet commented on May 18, 2024 1

@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.

pascalbaljet avatar pascalbaljet commented on May 18, 2024 1

Whoops, I made a wrong assumption. It's fixed in v0.6.1 and I also added a test for it :)

from laravel-splade.

J87NL avatar J87NL commented on May 18, 2024 1

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.

syedahnb avatar syedahnb commented on May 18, 2024

need to define update route separately.

**
image

image

**

from laravel-splade.

Sh1d0w avatar Sh1d0w commented on May 18, 2024

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.

Sh1d0w avatar Sh1d0w commented on May 18, 2024

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.

J87NL avatar J87NL commented on May 18, 2024

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.

syedahnb avatar syedahnb commented on May 18, 2024

make sure your package updated ,
image

from laravel-splade.

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.