<?php /**
 * Form Layout Wrapper
 * Usage:
 * <x-form.layout action="/submit" method="POST" id="myForm">...</x-form.layout>
 */ ?>
@props(['action' => '', 'method' => 'POST', 'id' => null])

<form @if($id) id="{{ $id }}" @endif action="{{ $action }}" method="{{ strtoupper($method) === 'GET' ? 'GET' : 'POST' }}" {{ $attributes }}>
    @if(strtoupper($method) !== 'GET')
        @csrf
    @endif
    
    @if(!in_array(strtoupper($method), ['GET', 'POST']))
        @method($method)
    @endif

    {{ $slot }}
</form>
