/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $usuario = \App\User::find($id); $compania = \App\Compania::All()->lists('nombreCompania', 'idCompania'); $rol = \App\Rol::All()->lists('nombreRol', 'idRol'); $tercero = \App\Tercero::where('Compania_idCompania', '=', \Session::get('idCompania'))->lists('nombreCompletoTercero', 'idTercero'); return view('users', compact('compania', 'rol', 'tercero'), ['usuario' => $usuario]); }
<?php $modificar = $_GET['modificar']; $eliminar = $_GET['eliminar']; $visibleM = ''; $visibleE = ''; if ($modificar == 1) { $visibleM = 'inline-block;'; } else { $visibleM = 'none;'; } if ($eliminar == 1) { $visibleE = 'inline-block;'; } else { $visibleE = 'none;'; } $compania = \App\Compania::All(); $row = array(); foreach ($compania as $key => $value) { $row[$key][] = '<a href="compania/' . $value['idCompania'] . '/edit">' . '<span class="glyphicon glyphicon-pencil" style = "display:' . $visibleM . '"></span>' . '</a> ' . '<a href="compania/' . $value['idCompania'] . '/edit?accion=eliminar">' . '<span class="glyphicon glyphicon-trash" style = "display:' . $visibleE . '"></span>' . '</a>'; $row[$key][] = $value['idCompania']; $row[$key][] = $value['codigoCompania']; $row[$key][] = $value['nombreCompania']; } $output['aaData'] = $row; echo json_encode($output);
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { \App\Compania::destroy($id); return redirect('/compania'); }