protonemedia / laravel-splade

💫 The magic of Inertia.js with the simplicity of Blade 💫 - Splade provides a super easy way to build Single Page Applications (SPA) using standard Laravel Blade templates, and sparkle it to make it interactive. All without ever leaving Blade.

Home Page:https://splade.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<Link method="POST" modal> performs a GET request

dusp2k opened this issue · comments

  • Laravel Version: 10
  • PHP Version: 8.2
  • Splade JS Version (npm): 1.4.16
  • Splade PHP Version (composer): 1.4.15.1
  • Dev environment (OS, Sail/Valet/etc): Windows

Any reason why this doesn't work? If I use the 'modal' attribute on <Link> it reverts back to being a GET request. It doesn't matter which method is used (POST, DELETE, PUT etc.)

<Link method="DELETE" href="{{ route('some_controller_name.destroy', $modelToDestroy) }}" modal confirm preserve-scroll>
	{{ __('Delete') }}
</Link>

@dusp2k I guess modal should open something or resource, that how I use it.
What are you trying to do?
From your code, it seems you are trying to delete a model. Why do you need a modal for that?

I assume you meant to use confirm instead of a modal.
If you are trying to warn the user or confirm the action before deletion, then confirm is what you should use, and not modal

I'm showing a SpladeTable in a modal with an option to delete rows. After deletion I want to stay in the modal, so I need to set the modal attrtibute. Else I'm redirected back to a full-page version of the list.

Shouldn't the functionalitity of the Link method attribute be the same regardless if I use modal or not?

hmm...I see maybe @pascalbaljet could help.

In the meantime, maybe not load the table into the modal