comparison 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
comparison
equal deleted inserted replaced
25:1a717c7b211f 26:555bfaa500ac
12 @csrf 12 @csrf
13 @if(isset($item)) 13 @if(isset($item))
14 @method('PUT') 14 @method('PUT')
15 @endif 15 @endif
16 16
17 @foreach($fields as $field) 17 {{ fieldsInsertPoint }}
18 <div class="mb-4"> 18
19 <label for="{{ $field }}" class="block text-gray-700">{{ ucfirst($field) }}</label>
20 <input type="text" name="{{ $field }}" id="{{ $field }}"
21 class="mt-1 block w-full rounded border-gray-300 shadow-sm focus:ring focus:ring-blue-200"
22 value="{{ old('$field', isset($item) ? $item->$field : '') }}">
23 @error($field)
24 <span class="text-red-600 text-sm">{{ $message }}</span>
25 @enderror
26 </div>
27 @endforeach
28 19
29 <div class="flex justify-end"> 20 <div class="flex justify-end">
30 <a href="{{ route('{{ tableName }}.index') }}" class="mr-2 px-4 py-2 bg-gray-200 rounded hover:bg-gray-300">Back</a> 21 <a href="{{ route('{{ tableName }}.index') }}" class="mr-2 px-4 py-2 bg-gray-200 rounded hover:bg-gray-300">Back</a>
31 <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700"> 22 <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">
32 {{ isset($item) ? 'Update' : 'Create' }} 23 {{ isset($item) ? 'Update' : 'Create' }}