view src/Generator/View/stubs/create_edit.stub @ 26:555bfaa500ac codex

Big update for view creation based on the column type.
author Luka Sitas <sitas.luka.97@gmail.com>
date Thu, 15 May 2025 21:50:38 -0400
parents 1a717c7b211f
children 8dd668020310
line wrap: on
line source

<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ isset($item) ? 'Edit' : 'Create' }} {{ ucfirst('{{ modelVariable }}') }}
        </h2>
    </x-slot>

    <div class="py-12">
        <div class="max-w-2xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6">
                <form method="POST" action="{{ isset($item) ? route('{{ tableName }}.update', $item) : route('{{ tableName }}.store') }}">
                    @csrf
                    @if(isset($item))
                        @method('PUT')
                    @endif

										{{ fieldsInsertPoint }}
										

                    <div class="flex justify-end">
                        <a href="{{ route('{{ tableName }}.index') }}" class="mr-2 px-4 py-2 bg-gray-200 rounded hover:bg-gray-300">Back</a>
                        <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">
                            {{ isset($item) ? 'Update' : 'Create' }}
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</x-app-layout>