/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { // $usuario = \Imprenta\User::All(); $user = array("Usuario" => '–Usuario–') + User::lists('name', 'id')->toArray(); $roles = array("Rol" => '–Rol–') + Role::where('status', 1)->lists('name', 'id')->toArray(); return view('roles.asignar_rol', compact('roles', 'user')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Request $request, $id) { //$permisorol = PermisoRoleModel::find($id); $permisorol = PermisoRoleModel::join('permission_user', 'permission_role.id', '=', 'permission_user.id')->find($id); $user = array("Usuario" => '–Usuario–') + User::lists('name', 'id')->toArray(); $permiso = array("Permisos" => '–Permisos–') + Permission::where('status', 1)->lists('name', 'id')->toArray(); $roles = array("Rol" => '–Rol–') + Role::where('status', 1)->lists('name', 'id')->toArray(); // $permisos = array("Permisos" => '–Permisos–') + Permission::where('status', 1)->lists('name', 'id')->toArray(); return view('permisos.asignar.edit', compact('permisorol', 'roles', 'user', 'permiso')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { User::create(['name' => $request['nombre'], 'email' => $request['email'], 'password' => $request['password']]); // UsuariosModel::create([ // 'nombre' => $request['nombre'], // 'apellidos' => $request['apellidos'], // 'email' => $request['email'], // 'usuario' => $request['nombre'], // 'password' => bcrypt($request['password']), // 'fecha_registro' => date("Y-m-d"), // 'fecha_activacion' => date("Y-m-d"), // 'fecha_actuliazacion' => date("Y-m-d"), // 'verificado' => '0', // 'estatus' => $request['estatus'], // 'acceso' => '1', // 'tipo_usuario' => $request['tipo_usuario'], // ]); return redirect('/usuario')->with('message', 'Datos Guardados Correctamente'); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }