Exemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //Get all the rols
     $rols = Rol::all();
     //Return the serialize array
     return response()->json($rols);
 }
 public function existRol($name)
 {
     $status = False;
     $roles = Rol::all();
     foreach ($roles as $rol) {
         if (strtolower($rol->name) == strtolower($name)) {
             $status = True;
         }
     }
     return $status;
 }
 public function edit($id)
 {
     if (Auth::user()->getRol() == "Institución" && Auth::user()->extractRolName($id) == "Administrador") {
         Session::flash('message', 'No posee privilegios');
         return redirect()->route('entidades.index');
     }
     if (Auth::user()->getRol() == "Institución" && Auth::user()->checkRol($id) == "Institución") {
         if (Auth::user()->getNameEntity() != Auth::user()->nameEntity($id)) {
             Session::flash('message', 'No posee privilegios para editar esta entidad');
             return redirect()->route('entidades.index');
         }
     }
     $view = Auth::user()->getView();
     $roles = Rol::all();
     $entity = Entity::findOrFail($id);
     return view('entities.edit', compact('entity', 'roles', 'view'));
 }
Exemplo n.º 4
0
 /**
  * Muestra vista roles con un arreglo de roles
  *
  * @return view pages.roles.index
  */
 public function index()
 {
     $rols = Rol::all();
     return view('pages.roles.index')->with('rols', $rols);
 }
Exemplo n.º 5
0
 public function interaccion_vistas()
 {
     $roles = Rol::all();
     return view('interaccion_vistas/roles', compact('roles'));
 }