10 changed files with 176 additions and 75 deletions
@ -0,0 +1,70 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Http\Controllers; |
||||
|
|
||||
|
use App\Models\User; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class UsuariosController extends Controller |
||||
|
{ |
||||
|
/** |
||||
|
* Display a listing of the resource. |
||||
|
*/ |
||||
|
public function index() |
||||
|
{ |
||||
|
$users = User::all(); |
||||
|
|
||||
|
return view('usuarios',['users'=> $users]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Show the form for creating a new resource. |
||||
|
*/ |
||||
|
public function create() |
||||
|
{ |
||||
|
return view('usuariosCrearEditar'); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Store a newly created resource in storage. |
||||
|
*/ |
||||
|
public function store(Request $request) |
||||
|
{ |
||||
|
|
||||
|
$user = new User(request()->all()); |
||||
|
$user->save(); |
||||
|
return redirect(route('usuarios')); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Display the specified resource. |
||||
|
*/ |
||||
|
public function show(string $id) |
||||
|
{ |
||||
|
// |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Show the form for editing the specified resource. |
||||
|
*/ |
||||
|
public function edit(string $id) |
||||
|
{ |
||||
|
// |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Update the specified resource in storage. |
||||
|
*/ |
||||
|
public function update(Request $request, string $id) |
||||
|
{ |
||||
|
// |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Remove the specified resource from storage. |
||||
|
*/ |
||||
|
public function destroy(string $id) |
||||
|
{ |
||||
|
// |
||||
|
} |
||||
|
} |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 33 KiB |
@ -0,0 +1,42 @@ |
|||||
|
@extends('layouts.plantilla') |
||||
|
|
||||
|
@section('titulo') |
||||
|
Modulo Usuarios |
||||
|
@endsection |
||||
|
|
||||
|
|
||||
|
@section('contenido') |
||||
|
<div class="container"> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-12 p-5"> |
||||
|
<h1>Usuarios</h1> |
||||
|
</div> |
||||
|
<div class="col-12"> |
||||
|
<div class="bg-light rounded h-100 p-4"> |
||||
|
<a href="{{route('usuarios.create')}}" class="btn btn-primary">Crear Usuario</a> |
||||
|
<div class="table-responsive"> |
||||
|
<table class="table"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th scope="col">#</th> |
||||
|
<th scope="col">Nombre</th> |
||||
|
<th scope="col">Correo</th> |
||||
|
<th scope="col">Fecha</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
@foreach ($users as $item) |
||||
|
<tr> |
||||
|
<th scope="row">{{$item->id}}</th> |
||||
|
<td>{{$item->name}}</td> |
||||
|
<td>{{$item->email}}</td> |
||||
|
<td>{{$item->created_at}}</td> |
||||
|
</tr> |
||||
|
@endforeach |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
@ -0,0 +1,36 @@ |
|||||
|
@extends('layouts.plantilla') |
||||
|
|
||||
|
@section('titulo') |
||||
|
Nuevo Usuario |
||||
|
@endsection |
||||
|
|
||||
|
@section('contenido') |
||||
|
<div class="container"> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-12"> |
||||
|
<h3>Nuevo Usuario</h3> |
||||
|
</div> |
||||
|
<di class="col-md-6 offset-3"> |
||||
|
<div class="bg-light rounded h-100 p-4"> |
||||
|
<form action="{{route('usuarios.store')}}" method="post"> |
||||
|
@csrf |
||||
|
<div class="mb-3"> |
||||
|
<label for="Name" class="form-label">Nombre</label> |
||||
|
<input type="text" class="form-control" id="Name" name="name"> |
||||
|
</div> |
||||
|
<div class="mb-3"> |
||||
|
<label for="email" class="form-label">Correo</label> |
||||
|
<input type="email" class="form-control" id="email" name="email"> |
||||
|
</div> |
||||
|
<div class="mb-3"> |
||||
|
<label for="password" class="form-label">Contraseña</label> |
||||
|
<input type="password" class="form-control" id="password" name="password"> |
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Agregar</button> |
||||
|
<a href="{{route('usuarios')}}" class="btn btn-danger">Cancelar</a> |
||||
|
</form> |
||||
|
</div> |
||||
|
</di> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
Loading…
Reference in new issue