Files
starter-kit/resources/views/components/form/form.blade.php
T
2025-06-13 10:48:20 -10:00

23 lines
415 B
PHP

@props([
'method' => 'post',
'action' => null,
])
@php
$spoofed = in_array(strtolower($method), ['put', 'patch', 'delete']);
@endphp
<form method="{{ strtolower($method) === 'get' ? 'get' : 'post' }}"
action="{{ $action }}"
{{ $attributes }}>
@if(strtolower($method) !== 'get')
@csrf
@endif
@if($spoofed)
@method($method)
@endif
{{ $slot }}
</form>