Silva 2 weeks ago
parent
commit
93787b7026
  1. 1
      app/Http/Controllers/CapacidadController.php
  2. 4
      resources/views/capacidades.blade.php
  3. 8
      resources/views/capacidadesCrearEditar.blade.php

1
app/Http/Controllers/CapacidadController.php

@ -47,6 +47,7 @@ class CapacidadController extends Controller
*/
public function store(Request $request)
{
$capacidad = new Capacidad($request->all());
$capacidad->save();
return redirect()->route('capacidades.index')->with('success', 'Capacidad creada exitosamente.');

4
resources/views/capacidades.blade.php

@ -29,7 +29,7 @@
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Cantidad</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Capacidad</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Acciones</th>
</tr>
</thead>
@ -37,7 +37,7 @@
@foreach($capacidades as $capacidad)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $capacidad->id }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $capacidad->cantidad }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $capacidad->capacidad }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
<div class="flex gap-2">
<a href="{{ route('capacidades.edit', $capacidad->id) }}"

8
resources/views/capacidadesCrearEditar.blade.php

@ -51,15 +51,15 @@
<i class="fas fa-hashtag text-gray-400"></i>
</div>
<input type="number"
name="cantidad"
id="cantidad"
name="capacidad"
id="capacidad"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
value="{{ isset($capacidad) ? $capacidad->cantidad : old('cantidad') }}"
value="{{ isset($capacidad) ? $capacidad->capacidad : old('capacidad') }}"
placeholder="Ingrese la cantidad"
min="0"
required>
</div>
@error('cantidad')
@error('capacidad')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>

Loading…
Cancel
Save