当前位置: 首页>>代码示例>>PHP>>正文


PHP Facades\Hash类代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Hash的典型用法代码示例。如果您正苦于以下问题:PHP Hash类的具体用法?PHP Hash怎么用?PHP Hash使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Hash类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fire

 public function fire()
 {
     $user = new DashboardUser();
     $this->info("Provide admin credentials.\n\n");
     $user->name = $this->ask('Amin name: ');
     $user->email = $this->ask('Admin email: ');
     $user->password = Hash::make($this->secret('Admin password: '));
     $rights = [DashboardUser::CREATE];
     foreach (Config::get('dashboard::models') as $key => $model) {
         $rights[] = $key;
     }
     $user->rights = $rights;
     $this->info("\n\n");
     try {
         $user->validate();
     } catch (ValidatorException $e) {
         $messages = $e->getMessageBag()->getMessages();
         foreach ($messages as $message) {
             foreach ($message as $_message) {
                 $this->error($_message);
             }
         }
         exit;
     }
     $user->save();
     $this->info('Done');
 }
开发者ID:JordanSalazar,项目名称:dashboard,代码行数:27,代码来源:CreateCommand.php

示例2: store

 public function store(Request $request)
 {
     if (empty($request->get('primer_nombre')) || empty($request->get('primer_apellido')) || empty($request->get('email')) || empty($request->get('password')) || empty($request->get('id_universidad')) || empty($request->get('id_programa'))) {
         return response()->json(['error' => true, 'mensaje' => 'Error, Verifique que los datos no esten vacios']);
     } else {
         try {
             $programa_universidad = DB::table('programa_universidad')->join('programas', 'programas.id_programa', '=', 'programa_universidad.id_programa')->join('universidades', 'universidades.id_universidad', '=', 'programa_universidad.id_universidad')->where('programa_universidad.id_programa', '=', $request->get('id_programa'))->where('programa_universidad.id_universidad', '=', $request->get('id_universidad'))->where('universidades.estado', '=', 'activo')->where('programas.estado', '=', 'activo')->select('programa_universidad.id_universidad', 'programa_universidad.id_programa')->get();
             if ($programa_universidad) {
                 $user = $request->only('primer_nombre', 'primer_apellido', 'email', 'password', 'id_universidad', 'id_programa');
                 if ($this->validar_email($user['email'], 0)) {
                     return response()->json(['error' => true, 'mensaje' => 'El Email ya se encuentra registrado']);
                 } else {
                     $user['password'] = Hash::make($user['password']);
                     $user['rol'] = 'estudiante';
                     $usuario = User::create($user);
                     if ($usuario) {
                         $token = JWTAuth::fromUser($usuario);
                         return response()->json(['error' => false, 'mensaje' => 'Usuario Almacenado Exitosamente', 'usuario' => $usuario, 'token' => $token]);
                     } else {
                         return response()->json(['error' => false, 'mensaje' => 'Error al registrar Usuario']);
                     }
                 }
             } else {
                 return response()->json(['error' => false, 'mensaje' => 'Error al registrar Usuario, verifique la universidad y programa al cual quiere asociarse']);
             }
         } catch (\Exception $e) {
             return response()->json(['error' => false, 'mensaje' => 'Error al registrar Usuario', 'excepcion' => $e]);
         }
     }
 }
开发者ID:Adrian-Vergara,项目名称:aesap_servidor,代码行数:30,代码来源:UsuariosController.php

示例3: user

 public function user(Request $request, $id)
 {
     header("Content-Type:text/html;charset=utf-8");
     if (Auth::user()->hasRole("admin")) {
         $user = User::find($id);
         if ($request->method() == "POST") {
             $user = User::find($id);
             $user->username = $request->get('username');
             $user->mobile = $request->get('mobile');
             if ($request->get('password') != "") {
                 $user->password = Hash::make($request->get('password'));
             }
             $user->save();
             return redirect()->back()->withErrors('修改成功!');
         }
         $cert = array();
         if ($user->hasRole('bidder')) {
             //商家
             $cert = Certification::where('user_id', '=', $user->id)->get()->first();
             // var_dump($cert);
         }
         return view('admin.user')->with(array('user' => $user, 'cert' => $cert));
     } else {
         return redirect()->back()->withInput()->withErrors('您不是管理员,无法进行此操作。');
     }
 }
开发者ID:jiangyukun,项目名称:jingou,代码行数:26,代码来源:AdminController.php

示例4: postEdit

 public function postEdit(Request $request)
 {
     $validator = Validator::make($request->all(), ['first_name' => 'required', 'last_name' => 'required', 'gender' => ['required', 'in:male,female'], 'password' => 'min:6', 'martial_status' => ['in:single,engaged,married']]);
     if ($validator->fails()) {
         return redirect()->back()->withInput()->withErrors($validator);
     }
     if ($request->has('password') && $request->has('password_confirmation')) {
         if ($request->password === $request->password_confirmation) {
             Auth::user()->password = Hash::make($request->password);
             Auth::user()->save();
         } else {
             return redirect()->back()->withInput()->with('errors', ['Passwords does not match.']);
         }
     }
     $user = Auth::user();
     $user->first_name = $request->first_name;
     $user->last_name = $request->last_name;
     $user->gender = $request->gender;
     $user->birth_date = $request->has('birth_date') ? $request->birth_date : null;
     $user->phone = $request->has('phone') ? $request->phone : null;
     $user->bio = $request->has('bio') ? $request->bio : null;
     $user->marital_status = $request->has('marital_status') ? $request->marital_status : null;
     $user->save();
     return redirect()->route('profile.edit')->with('info', 'your profile has been updated');
 }
开发者ID:KareemBadawy,项目名称:Flarian,代码行数:25,代码来源:ProfileController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $person = new User();
     $person->first_name = $request->input('first-name');
     $person->last_name = $request->input('last-name');
     $person->email = $request->input('work-email');
     $person->personal_email = $request->input('personal-email');
     $person->password = Hash::make(uniqid());
     $person->address1 = $request->input('address-one');
     $person->address2 = $request->input('address-two');
     $person->zip = $request->input('postcode');
     $person->city = $request->input('city');
     $person->state = $request->input('state');
     $person->country = $request->input('country');
     $person->dob = Carbon::createFromFormat('d/m/Y', $request->input('dob'))->toDateString();
     $person->work_telephone = $request->input('work-telephone');
     $person->personal_telephone = $request->input('personal-telephone');
     $person->gender = $request->input('gender');
     $person->save();
     // Placeholder face until one is submitted
     $path = 'people/' . $person->id . '/face.jpg';
     \Illuminate\Support\Facades\Storage::put($path, file_get_contents('http://api.adorable.io/avatar/400/' . md5($person->id . $person->email . Carbon::now()->getTimestamp()) . ''));
     $person->save();
     // Default job position
     $person->jobPositions()->attach(1, ['primary' => true]);
     // Default role
     $person->roles()->attach(1, ['primary' => true]);
     return redirect()->intended('/people/');
 }
开发者ID:TeenageHelpline,项目名称:Progress,代码行数:36,代码来源:UserController.php

示例6: register

 public function register(Request $request)
 {
     $newUser = $request->all();
     $password = Hash::make($request->input('password'));
     $newUser['password'] = $password;
     User::create($newUser);
 }
开发者ID:ducaale,项目名称:university-management-app,代码行数:7,代码来源:authenticateController.php

示例7: authenticate

 public function authenticate(Request $request)
 {
     $credenciales = $request->only('email', 'password');
     try {
         if (!($token = JWTAuth::attempt($credenciales))) {
             return response()->json(['error' => 'Credenciales Invalidas'], 401);
         }
         $usuario = DB::table('usuarios')->where('email', '=', $request->get('email'))->first();
         if ($usuario) {
             if ($usuario->estado == "activo") {
                 if (Hash::check($credenciales['password'], $usuario->password)) {
                     $sesion = new SesionController();
                     if ($sesion->registrar_sesion($usuario->id_usuario)) {
                         return response()->json(['usuario' => $usuario, compact('token')], 201);
                     } else {
                         return response()->json(['error' => true, 'mensaje' => 'Error, intente iniciar sesion nuevamente']);
                     }
                 } else {
                     return response()->json(['error' => true, 'mensaje' => 'Error, Password Incorrecta']);
                 }
             } else {
                 return response()->json(['error' => true, 'mensaje' => 'Error, el usuario no existe']);
             }
         } else {
             return response()->json(['error' => true, 'mensaje' => 'Verifique email y password']);
         }
     } catch (JWTException $e) {
         return response()->json(['error' => 'Falta Token'], 500);
     }
 }
开发者ID:Adrian-Vergara,项目名称:aesap_servidor,代码行数:30,代码来源:AuthenticateController.php

示例8: boot

 public static function boot()
 {
     parent::boot();
     self::creating(function ($model) {
         $model->password = Hash::make($model->password);
     });
 }
开发者ID:kieransmith1993,项目名称:facebook2,代码行数:7,代码来源:User.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->truncate();
     DB::table('roles')->truncate();
     DB::table('role_user')->truncate();
     DB::table('permissions')->truncate();
     DB::table('permission_role')->truncate();
     DB::table('users')->insert(['name' => 'bd', 'email' => 'bd@loopeer.com', 'password' => Hash::make(config('quickcms.backend_password') ?: '111111'), 'status' => 1]);
     DB::table('roles')->insert(['name' => 'admin', 'display_name' => '超级管理员', 'description' => 'admin']);
     DB::table('role_user')->insert(['user_id' => 1, 'role_id' => 1]);
     $permissions = array(['name' => 'admin.index', 'display_name' => '欢迎页', 'parent_id' => '0', 'level' => 1, 'icon' => 'fa-home', 'route' => '/admin/index', 'sort' => 1], ['name' => 'system', 'display_name' => '权限管理', 'parent_id' => '0', 'level' => 1, 'icon' => 'fa-group', 'route' => '#', 'sort' => 2], ['name' => 'maintenance', 'display_name' => '运维管理', 'parent_id' => '0', 'level' => 1, 'icon' => 'fa-desktop', 'route' => '#', 'sort' => 3], ['name' => 'develop', 'display_name' => '开发工具', 'parent_id' => '0', 'level' => 1, 'icon' => 'fa-wrench', 'route' => '#', 'sort' => 4], ['name' => 'email', 'display_name' => '邮件管理', 'parent_id' => '0', 'level' => 1, 'icon' => 'fa-envelope', 'route' => '#', 'sort' => 5], ['name' => 'admin.users.index', 'display_name' => '用户管理', 'parent_id' => '2', 'level' => 2, 'icon' => '', 'route' => '/admin/users', 'sort' => 1], ['name' => 'admin.permissions.index', 'display_name' => '权限管理', 'parent_id' => '2', 'level' => 2, 'icon' => '', 'route' => '/admin/permissions', 'sort' => 2], ['name' => 'admin.roles.index', 'display_name' => '角色管理', 'parent_id' => '2', 'level' => 2, 'icon' => '', 'route' => '/admin/roles', 'sort' => 3], ['name' => 'admin.feedbacks.index', 'display_name' => '意见反馈', 'parent_id' => '3', 'level' => 2, 'icon' => '', 'route' => '/admin/feedbacks', 'sort' => 1], ['name' => 'admin.versions.index', 'display_name' => '版本管理', 'parent_id' => '3', 'level' => 2, 'icon' => '', 'route' => '/admin/versions', 'sort' => 2], ['name' => 'admin.systems.index', 'display_name' => '系统设置', 'parent_id' => '3', 'level' => 2, 'icon' => '', 'route' => '/admin/systems', 'sort' => 3], ['name' => 'admin.statistics.index', 'display_name' => '统计分析', 'parent_id' => '3', 'level' => 2, 'icon' => '', 'route' => '/admin/statistics/index', 'sort' => 4], ['name' => 'admin.document.index', 'display_name' => '文档管理', 'parent_id' => '3', 'level' => 2, 'icon' => '', 'route' => '/admin/document', 'sort' => 5], ['name' => 'admin.pushes.index', 'display_name' => '推送管理', 'parent_id' => '3', 'level' => 2, 'icon' => '', 'route' => '/admin/pushes', 'sort' => 6], ['name' => 'admin.logs', 'display_name' => '查看日志', 'parent_id' => '4', 'level' => 2, 'icon' => '', 'route' => '/admin/logs', 'sort' => 1], ['name' => 'admin.actionLogs.index', 'display_name' => '后台日志管理', 'parent_id' => '4', 'level' => 2, 'icon' => '', 'route' => '/admin/actionLogs', 'sort' => 2], ['name' => 'admin.selector.index', 'display_name' => '下拉枚举管理', 'parent_id' => '4', 'level' => 2, 'icon' => '', 'route' => '/admin/selector', 'sort' => 3], ['name' => 'admin.sendcloud.index', 'display_name' => 'SendCloud', 'parent_id' => '5', 'level' => 2, 'icon' => '', 'route' => '/admin/sendcloud', 'sort' => 1]);
     DB::table('permissions')->insert($permissions);
     $permission_role = array();
     foreach (range(0, count($permissions) - 1) as $index) {
         $permission_role[] = ['permission_id' => $index + 1, 'role_id' => 1];
     }
     DB::table('permission_role')->insert($permission_role);
     $system_keys = ['build', 'app_review', 'android_download'];
     $system_values = ['10000', 'false', 'fir.im'];
     $system_descriptions = ['网站标题', '版本号', '版本审核状态', '安卓apk下载链接'];
     $systems = array();
     foreach ($system_keys as $key => $value) {
         $systems[] = array('system_key' => $value, 'system_value' => $system_values[$key], 'description' => $system_descriptions[$key]);
     }
     DB::table('systems')->insert($systems);
 }
开发者ID:loopeer,项目名称:quickcms,代码行数:31,代码来源:InitBackendSeeder.php

示例10: run

 public function run()
 {
     DB::table('users')->delete();
     $user = new User();
     $user->username = 'Leo';
     $user->email = 'aito0077@gmail.com';
     $user->password = Hash::make('kierkegaard');
     $user->save();
     $user = new User();
     $user->username = 'usuario1';
     $user->email = 'usuario1@test.com';
     $user->password = Hash::make('usuario1');
     $user->save();
     $user = new User();
     $user->username = 'usuario2';
     $user->email = 'usuario2@test.com';
     $user->password = Hash::make('usuario2');
     $user->save();
     $user = new User();
     $user->username = 'usuario3';
     $user->email = 'usuario3@test.com';
     $user->password = Hash::make('usuario3');
     $user->save();
     $user = new User();
     $user->username = 'participante1';
     $user->email = 'participante1@test.com';
     $user->password = Hash::make('participante1');
     $user->participant = true;
     $user->save();
 }
开发者ID:Coperable,项目名称:slam_webapp,代码行数:30,代码来源:UsersTableSeeder.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $persona = new \PlataformaVirtual\Models\Persona();
     $persona->nombres = $request->nombres;
     $persona->apellidopaterno = $request->apellidopaterno;
     $persona->apellidomaterno = $request->apellidomaterno;
     $persona->correo = $request->correo;
     $persona->celular = $request->celular;
     $persona->fechnac = $request->fechanac;
     $persona->codigotipodocumento = $request->tipoDoc;
     $persona->numerodocumento = $request->numDoc;
     $persona->save();
     $empleado = new \PlataformaVirtual\Models\Empleado();
     $empleado->codigoempleado = $persona->codigo;
     $empleado->codigolocal = $request->codigoLocal;
     $empleado->tipo = $request->tipo;
     $empleado->save();
     $usuario = new \PlataformaVirtual\User();
     $usuario->password = Hash::make($request->contrasenia);
     $usuario->email = $request->correo;
     $usuario->tiporegistro = "MV";
     $usuario->codigopersona = $persona->codigo;
     $usuario->vigencia = $request->vigencia;
     $usuario->codigonegocio = $request->idEmpresa;
     $usuario->save();
     $roleUser = new \PlataformaVirtual\Models\Role_User();
     $roleUser->role_id = 2;
     //en la BD se ha asignado como Rol id=2 al Negocio o mype
     $roleUser->user_id = $usuario->codigo;
     $roleUser->save();
     return response()->json(['msg' => "Success"], 200);
 }
开发者ID:edermax21,项目名称:PlataformaVirtual,代码行数:37,代码来源:EmpleadoController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\UserCreationRequest $request)
 {
     $admin = User::create($request->all());
     $admin->password = Hash::make($request->input('password'));
     $admin->save();
     return redirect('login');
 }
开发者ID:jardayn,项目名称:portfolio,代码行数:13,代码来源:UsersController.php

示例13: logar

 public function logar(Request $request)
 {
     $validacao = Validator::make($request->all(), ['email' => 'required|email', 'password' => 'required|string']);
     if ($validacao->fails()) {
         return redirect('admin/login')->withErrors($validacao)->withInput();
     } else {
         $usuario = User::where('email', '=', $request->email)->first();
         if ($usuario) {
             $senhaIgual = Hash::check($request->password, $usuario->password);
             if ($senhaIgual) {
                 if (!Auth::check()) {
                     Auth::login($usuario);
                     $usuario->ultimo_acesso = date('Y-m-d H:i:s');
                     $usuario->save();
                     return Redirect::to('/admin/dashboard');
                 } elseif (Auth::check()) {
                     $usuario->ultimo_acesso = date('Y-m-d H:i:s');
                     $usuario->save();
                     return Redirect::to('/admin/dashboard');
                 } else {
                     session()->flash('flash_message', 'Usuário ou senha inválidos');
                     return Redirect::to('/admin/login')->withInput();
                 }
             } else {
                 session()->flash('flash_message', 'Usuário ou senha inválidos');
                 return Redirect::to('/admin/login')->withInput();
             }
         } else {
             session()->flash('flash_message', 'Usuário ou senha inválidos');
             return Redirect::to('/admin/login')->withInput();
         }
     }
 }
开发者ID:safaricco,项目名称:admfw,代码行数:33,代码来源:Login.php

示例14: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Validator::extend('check_auth_user_password', function ($attribute, $value, $parameters, $validator) {
         return Hash::check($value, Auth::user()->password);
     });
     // Make sure client email is not used by another client of current user
     Validator::extend('email_not_used_by_another_user_client', function ($attribute, $value, $parameters, $validator) {
         if (Client::where('user_id', Auth::user()->id)->where('email', $value)->count()) {
             return false;
         }
         return true;
     });
     // Make sure client phone number is not user by another client of current user
     Validator::extend('phone_number_not_used_by_another_user_client', function ($attribute, $value, $parameters, $validator) {
         if (Client::where('user_id', Auth::user()->id)->where('phone_number', $value)->count()) {
             return false;
         }
         return true;
     });
     Validator::extend('not_exists', function ($attribute, $value, $parameters, $validator) {
         return !DB::table($parameters[0])->where($parameters[1], $value)->count();
     });
     Validator::extend('is_not_in_auth_user_products', function ($attribute, $value, $parameters, $validator) {
         return !DB::table('products')->where('user_id', \Auth::user()->id)->where('code', $value)->count();
     });
 }
开发者ID:bitller,项目名称:nova,代码行数:31,代码来源:AppServiceProvider.php

示例15: reset_password

 public function reset_password()
 {
     $pass = uniqid();
     $this->password = Hash::make($pass);
     $this->save();
     return $pass;
 }
开发者ID:zentefi,项目名称:zentefi-laravel,代码行数:7,代码来源:UserLoginTrait.php


注:本文中的Illuminate\Support\Facades\Hash类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。