meobda-website/resources/views/components/form/form.blade.php

14 lines
338 B
PHP

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