Skip to content

Instantly share code, notes, and snippets.

@dlnsk
Last active April 11, 2024 11:18
Show Gist options
  • Save dlnsk/8c95827decbde711aaa8e360b8632f28 to your computer and use it in GitHub Desktop.
Save dlnsk/8c95827decbde711aaa8e360b8632f28 to your computer and use it in GitHub Desktop.
Button component integrated with form and confirmation request (Laravel)
@props([
'action',
'method' => 'post',
'class' => '',
'confirmation' => ''
])
<form style="display: inline;" action="{{ $action }}" method="post">
<button type="submit"
class="{{ $class }}"
onclick="if('{{ $confirmation }}'.length && !confirm('{{ $confirmation }}')) return false;"
>
{{ $slot }}
</button>
@csrf
@method($method)
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment