Add form component

This commit is contained in:
Matt Young 2025-12-13 18:08:30 -06:00
parent f9228fe901
commit c3fad776f5
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
@props(['action', 'method'=>'POST'])
@php
$method = strtoupper($method);
$formMethod = in_array($method, ['GET', 'POST']) ? $method : 'POST';
@endphp
<form {{ $attributes }} method="{{ $formMethod }}" action="{{ $action }}">
@csrf
@if( $formMethod !== $method)
@method($method)
@endif
{{ $slot }}
</form>