This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd9edb7
commit cae896f
Showing
8 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Persona; | ||
use Illuminate\Http\Request; | ||
use Psy\CodeCleaner\ReturnTypePass; | ||
|
||
class PersonaController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index() | ||
{ | ||
$personas = Persona::get(); | ||
return view('admin.Persona.index', compact('personas')); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function create() | ||
{ | ||
return view('admin.Persona.create'); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
$datos = $request->all(); | ||
Persona::create($datos); | ||
return to_route('personas.index'); | ||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
* | ||
* @param \App\Models\Persona $persona | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function show(Persona $persona) | ||
{ | ||
return view('admin.Persona.show', compact('persona')); | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
* | ||
* @param \App\Models\Persona $persona | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function edit(Persona $persona) | ||
{ | ||
return view('admin.Persona.edit', compact('persona')); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \App\Models\Persona $persona | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function update(Request $request, Persona $persona) | ||
{ | ||
$datos = $request->all(); | ||
$persona->update($datos); | ||
return to_route('personas.index'); | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* | ||
* @param \App\Models\Persona $persona | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function destroy(Persona $persona) | ||
{ | ||
$persona->delete(); | ||
return to_route('personas.index'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Persona extends Model | ||
{ | ||
use HasFactory; | ||
protected $primaryKey = 'id_persona'; | ||
protected $table = 'personas'; | ||
protected $fillable = [ | ||
'nombre_per', | ||
'apellido_pa_per', | ||
'apellido_ma_per', | ||
'ci_per', | ||
'cel_per', | ||
'fecha_nac', | ||
'num_seguro', | ||
'donante', | ||
'id_tipo_sangre' | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<x-layouts.app> | ||
<div class="card"> | ||
<div class="card-header">Registro de Personas</div> | ||
<div class="card-body"> | ||
|
||
<form action="{{ route('personas.store') }}" method="post"> | ||
@csrf | ||
<label>Nombres</label></br> | ||
<input type="text" name="nombre_per" class="form-control"></br> | ||
<label>Apellido Paterno</label></br> | ||
<input type="text" name="apellido_pa_per" class="form-control"></br> | ||
<label>Apellido Materno</label></br> | ||
<input type="text" name="apellido_ma_per" class="form-control"></br> | ||
<label>Carnet de Identidad</label></br> | ||
<input type="text" name="ci_per" class="form-control"></br> | ||
<label>Celular</label></br> | ||
<input type="text" name="cel_per" class="form-control"></br> | ||
<label>Fecha Nacimiento</label></br> | ||
<input type="date" name="fecha_nac" class="form-control"></br> | ||
<label>Numero de Seguro</label></br> | ||
<input type="text" name="num_seguro" class="form-control"></br> | ||
<label>Es donante</label></br> | ||
<input type="text" name="donante" class="form-control"></br> | ||
<label>Tipo de Sangre</label></br> | ||
<input type="text" name="id_tipo_sangre" class="form-control"></br> | ||
<input type="submit" value="Save" class="btn btn-success"></br> | ||
</form> | ||
|
||
</div> | ||
</div> | ||
</x-layouts.app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<x-layouts.app> | ||
<div class="card"> | ||
<div class="card-header">Registro de Personas</div> | ||
<div class="card-body"> | ||
|
||
<form action="{{ route('personas.update', $persona) }}" method="post"> | ||
@csrf | ||
@method('PATCH') | ||
<label>Nombres</label></br> | ||
<input value="{{ $persona->nombre_per }}" type="text" name="nombre_per" class="form-control"></br> | ||
<label>Apellido Paterno</label></br> | ||
<input value="{{ $persona->apellido_pa_per }}" type="text" name="apellido_pa_per" class="form-control"></br> | ||
<label>Apellido Materno</label></br> | ||
<input value="{{ $persona->apellido_ma_per }}" type="text" name="apellido_ma_per" class="form-control"></br> | ||
<label>Carnet de Identidad</label></br> | ||
<input value="{{ $persona->ci_per }}" type="text" name="ci_per" class="form-control"></br> | ||
<label>Celular</label></br> | ||
<input value="{{ $persona->cel_per }}" type="text" name="cel_per" class="form-control"></br> | ||
<label>Fecha Nacimiento</label></br> | ||
<input value="{{ $persona->fecha_nac }}" type="date" name="fecha_nac" class="form-control"></br> | ||
<label>Numero de Seguro</label></br> | ||
<input value="{{ $persona->num_seguro }}" type="text" name="num_seguro" class="form-control"></br> | ||
<label>Es donante</label></br> | ||
<input value="{{ $persona->donante }}" type="text" name="donante" class="form-control"></br> | ||
<label>Tipo de Sangre</label></br> | ||
<input value="{{ $persona->id_tipo_sangre }}" type="text" name="id_tipo_sangre" class="form-control"></br> | ||
<input type="submit" value="Save" class="btn btn-success"></br> | ||
</form> | ||
</div> | ||
</div> | ||
</x-layouts.app> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<x-layouts.app> | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="col"> | ||
<div class="card"> | ||
<div class="card-header"> | ||
<h2>Personas</h2> | ||
</div> | ||
<div class="card-body"> | ||
<a href="{{ route('personas.create') }}" class="btn btn-success btn-sm" title="Añadir nueva Persona"> | ||
<i class="fa fa-plus" aria-hidden="true"></i> Nueva Persona | ||
</a> | ||
<br> | ||
<br> | ||
<div class="table-responsive"> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Nombre</th> | ||
<th>AP</th> | ||
<th>AM</th> | ||
<th>CI</th> | ||
<th>Celular</th> | ||
<th>Fecha Nac</th> | ||
<th># Seguro</th> | ||
<th>Es donante</th> | ||
<th>Tipo Sangre</th> | ||
<th>Acciones</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach ($personas as $persona) | ||
<tr> | ||
<td>{{ $persona->nombre_per }}</td> | ||
<td>{{ $persona->apellido_pa_per }}</td> | ||
<td>{{ $persona->apellido_ma_per }}</td> | ||
<td>{{ $persona->ci_per }}</td> | ||
<td>{{ $persona->cel_per }}</td> | ||
<td>{{ $persona->fecha_nac }}</td> | ||
<td>{{ $persona->num_seguro }}</td> | ||
<td>{{ $persona->donante }}</td> | ||
<td>{{ $persona->id_tipo_sangre }}</td> | ||
<td> | ||
<a href="{{ route('personas.show', $persona) }}" | ||
title="View Student"><button class="btn btn-info btn-sm"><i | ||
class="fa fa-eye" aria-hidden="true"></i> | ||
Mostrar</button></a> | ||
<a href="{{ route('personas.edit', $persona) }}" | ||
title="Edit Student"><button class="btn btn-primary btn-sm"><i | ||
class="fa fa-pencil-square-o" aria-hidden="true"></i> | ||
Editar</button></a> | ||
<form method="POST" action="{{ route('personas.destroy', $persona) }}" | ||
accept-charset="UTF-8" style="display:inline"> | ||
@method('DELETE') | ||
@csrf | ||
<button type="submit" class="btn btn-danger btn-sm" | ||
title="Delete Student" | ||
onclick="return confirm("Confirm delete?")"><i | ||
class="fa fa-trash-o" aria-hidden="true"></i> | ||
Borrar</button> | ||
</form> | ||
</td> | ||
</tr> | ||
@endforeach | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</x-layouts.app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<x-layouts.app> | ||
<div class="card"> | ||
<div class="card-header">Datos de la Persona</div> | ||
<div class="card-body"> | ||
<div class="card-body"> | ||
<h5 class="card-title">Nombres : {{ $persona->nombre_per }}</h5> | ||
<p class="card-text">Apellido Paterno: {{ $persona->apellido_pa_per }}</p> | ||
<p class="card-text">Apellido Materno : {{ $persona->apellido_ma_per }}</p> | ||
<p class="card-text">Carnet de Identidad: {{ $persona->ci_per }}</p> | ||
<p class="card-text">Celular: {{ $persona->cel_per }}</p> | ||
<p class="card-text">Fecha de Nacimiento: {{ $persona->fecha_nac }}</p> | ||
<p class="card-text">Numero de Seguro: {{ $persona->num_seguro }}</p> | ||
<p class="card-text">Es donante: {{ $persona->donante }}</p> | ||
<p class="card-text">Tipo de Sangre: {{ $persona->id_tipo_sangre }}</p> | ||
</div> | ||
</hr> | ||
</div> | ||
</div> | ||
</x-layouts.app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters