-
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
c169f87
commit 05b0fc1
Showing
10 changed files
with
223 additions
and
5 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,102 @@ | ||
<?php | ||
|
||
namespace CandyUcab\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use CandyUcab\Privilegio; | ||
use Illuminate\Support\Facades\DB; | ||
class PrivilegioController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index() | ||
{ | ||
$privilegio= Privilegio::all(); | ||
//le paso a la vista todos los productos enla BD | ||
return view ('privilegios.index-privilegio',compact('privilegio')); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function create() | ||
{ | ||
return view ('privilegios.create-privilegio'); | ||
|
||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
$privilegio= new Privilegio(); | ||
$privilegio->p_nombre = $request->input('nombre'); | ||
$privilegio->save(); | ||
$privilegio= Privilegio::all(); | ||
//le paso a la vista todos los productos enla BD | ||
return view ('privilegios.index-privilegio',compact('privilegio')); | ||
|
||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function show($id) | ||
{ | ||
$privilegios= DB::table('privilegio')->where('p_cod', $id)->get(); | ||
|
||
return view ('privilegios.show-privilegio',compact('privilegios')); | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function edit($id) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function update(Request $request, $id) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function destroy($id) | ||
{ | ||
DB::table('privilegio')->where('p_cod',$id )->delete(); | ||
|
||
$privilegio= Privilegio::all(); | ||
//le paso a la vista todos los productos enla BD | ||
return view ('privilegios.index-privilegio',compact('privilegio')); | ||
|
||
|
||
} | ||
} |
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
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
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,44 @@ | ||
@extends('layouts.menuadmin') | ||
|
||
@section('title', 'Crear Rol') | ||
|
||
@section('contenido') | ||
<form class="form-group" action="/privilegios" method="POST" > | ||
@csrf | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-12 text-center"> | ||
<h1 class="titulos-principales">Crear Privilegio </h1> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-md-offset-4 col-md-4"> | ||
|
||
<div class="modal-body"> | ||
|
||
|
||
<label for="">nombre </label> | ||
<div class="form-group"> | ||
<!-- Campo de entrada de fecha --> | ||
<input type="text" name="nombre"> | ||
</div> | ||
|
||
</div> | ||
|
||
<div class="form-group"> | ||
<input type="submit" class="btn btn-block btn-lg btn-primary" value="Crear Privilegio"/> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
|
||
|
||
|
||
|
||
@stop |
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 @@ | ||
@extends('layouts.menuadmin') |
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,33 @@ | ||
@extends('layouts.menuadmin') | ||
|
||
@section('title', 'Privilegios') | ||
|
||
@section('contenido') | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-12 text-center"> | ||
<h1>Privilegios</h1> | ||
<p><a href="/">Inicio</a> > Privilegios</p> | ||
</div> | ||
</div> | ||
<div class="contenedor-productos"> | ||
@foreach ($privilegio as $pri) | ||
|
||
<div class="card text-center" id="contenedorCarta"> | ||
<!-- asignamos la ruta de la bas de datos a la impresion --> | ||
<div class="text-center"> | ||
<div class="card-body"> | ||
<h2>{{$pri->p_nombre}}</h2> | ||
|
||
<a class="btn btn-primary btn-lg" href="/privilegios/{{$pri->p_cod}}">Ver más...</a> | ||
<p> </p> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
@endforeach | ||
</div> | ||
<a class="btn btn-primary btn-lg botoncito" href="/privilegios/create">Crear Privilegio</a> | ||
@stop | ||
|
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,28 @@ | ||
@extends('layouts.menuadmin') | ||
|
||
@section('title', 'Privilegios') | ||
|
||
@section('contenido') | ||
|
||
<div class="text-center"> | ||
@foreach($privilegios as $pri) | ||
<h1 >{{$pri->p_nombre}}</h1> <p></p> | ||
<span > <b> Cod: </b> {{$pri->p_cod}}</span> <br> | ||
|
||
|
||
|
||
|
||
<div > | ||
@if(Auth::user()->hasRole('admin')) | ||
|
||
<a class="btn btn-primary btn-lg botoncito" href="/privilegios/{{$pri->p_cod}}/edit">Actualizar</a> | ||
{!! Form::open(['route'=>['privilegios.destroy',$pri->p_cod],'method'=>'DELETE' ]) !!} | ||
{!! Form::submit('Eliminar',['class'=>'btn btn-danger']) !!} | ||
{!! Form::close() !!} | ||
|
||
</div> | ||
|
||
@endif | ||
@endforeach | ||
</div> | ||
@stop |
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