本文整理汇总了PHP中Hash::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Hash::make方法的具体用法?PHP Hash::make怎么用?PHP Hash::make使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hash
的用法示例。
在下文中一共展示了Hash::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createParent
public function createParent()
{
$input = Input::all();
if (Input::hasFile('profilepic')) {
$input['profilepic'] = $this->filestore(Input::file('profilepic'));
}
$input['dob'] = date('Y-m-d H:i:s', strtotime(Input::get('dob')));
$input['collegeid'] = Session::get('user')->collegeid;
$input['collegename'] = Admin::where('collegeid', '=', Session::get('user')->collegeid)->first()->collegename;
//$input['collegeid']="dummy";
//$input['collegename']="dummy";
$user = new User();
$user->email = $input['email'];
$user->password = Hash::make($input['password']);
$user->collegeid = $input['collegeid'];
$user->flag = 3;
$user->save();
$input['loginid'] = $user->id;
$removed = array('_token', 'password', 'cpassword');
foreach ($removed as $k) {
unset($input[$k]);
}
Parent::saveFormData($input);
return $input;
}
示例2: run
public function run()
{
User::create(array('group_id' => 1, 'name' => 'Разработчик', 'surname' => '', 'email' => 'developer@newyork-bar.ru', 'active' => 1, 'password' => Hash::make('grapheme1234'), 'photo' => '', 'thumbnail' => '', 'temporary_code' => '', 'code_life' => 0, 'remember_token' => 'Ycr4p62EPv3x3UWabeo3NpiSdJmI7hT3E460C5eTuiFKp1Vbjg6WL2M2bmPv'));
DB::table('sessions')->insert(array(array('id' => '80b1264be73168dfa026345d79abc86a1d29660c', 'payload' => 'YTo2OntzOjY6Il90b2tlbiI7czo0MDoiQXVsQ0M1Y0dhQTJMV2lKWVF4VTVlUkRtZ0s0NE5wdFRHeXh2eEdjMSI7czo2OiJsb2NhbGUiO3M6MjoicnUiO3M6MjI6IlBIUERFQlVHQkFSX1NUQUNLX0RBVEEiO2E6MDp7fXM6NToiZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czozODoibG9naW5fODJlNWQyYzU2YmRkMDgxMTMxOGYwY2YwNzhiNzhiZmMiO2k6MTtzOjk6Il9zZjJfbWV0YSI7YTozOntzOjE6InUiO2k6MTQxNjM5OTU3MztzOjE6ImMiO2k6MTQxNjM5Mzg3ODtzOjE6ImwiO3M6MToiMCI7fX0=', 'last_activity' => time())));
User::create(array('group_id' => 2, 'name' => 'Администратор', 'surname' => '', 'email' => 'admin@newyork-bar.ru', 'active' => 1, 'password' => Hash::make('grapheme1234'), 'photo' => '', 'thumbnail' => '', 'temporary_code' => '', 'code_life' => 0));
User::create(array('group_id' => 3, 'name' => 'Модератор', 'surname' => '', 'email' => 'moder@newyork-bar.ru', 'active' => 1, 'password' => Hash::make('grapheme1234'), 'photo' => '', 'thumbnail' => '', 'temporary_code' => '', 'code_life' => 0));
}
示例3: postCreate
/**
* This function create employee
* when data is posted from
* /admin/employee/create
*/
public function postCreate()
{
// Check validation
$validator = Validator::make(Input::all(), Employee::$rulesForCreate, Employee::$messages);
// If failed then redirect to employee-create-get route with
// validation error and input old
if ($validator->fails()) {
return Redirect::route('employee-create-get')->withErrors($validator)->withInput();
}
// If validation is not failed then create employee
$employee = Employee::create(array('first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'age' => Input::get('age'), 'gender' => Input::get('gender'), 'DOB' => DateFormat::store(Input::get('DOB')), 'present_address' => Input::get('present_address'), 'permanent_address' => Input::get('permanent_address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'country' => Input::get('country'), 'mobile_no' => Input::get('mobile_no'), 'email' => Input::get('email'), 'created_by' => Session::get('username')));
// Also create user account for the employee
$user = User::create(array('details_id' => $employee->id, 'username' => Input::get('username'), 'email' => $employee->email, 'user_level' => Input::get('userlevel'), 'active' => 0));
// generate random code and password
$password = str_random(10);
$code = str_random(60);
$newHashPassword = Hash::make($password);
// Save new password and code
$user->password_tmp = $newHashPassword;
$user->activation_code = $code;
if ($user->save()) {
// Send email to the employee.
// This email contains username,password,activation link
Mail::send('emails.auth.activation', array('first_name' => $employee->first_name, 'last_name' => $employee->last_name, 'username' => $user->username, 'password' => $password, 'activation_link' => URL::route('activation-get', $code)), function ($message) use($user) {
$message->to($user->email, $user->username)->subject('Confirm Activation');
});
}
return View::make('adminArea.employee.create')->with('success', 'Activation link has been sent successfully');
}
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
for ($i = 0; $i < 40; $i++) {
\DB::table('usuarios')->insert(array('snombre' => $faker->firstname, 'sapellido' => $faker->lastname, 'scontrasena' => \Hash::make('12345'), 'scorreo' => $faker->unique()->email, 'badministra' => 0));
}
}
示例5: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create('pt_BR');
for ($i = 0; $i < 10; $i++) {
DB::table('users')->insert(array('name' => $faker->name, 'telefone' => $faker->cellphone, 'email' => $faker->unique()->email, 'password' => \Hash::make('123456'), 'role' => 'user'));
}
}
示例6: run
public function run()
{
DB::statement('SET FOREIGN_KEY_CHECKS = 0');
// disable foreign key constraints
// Reset table
DB::table('users')->truncate();
// Reset table
DB::table('user_details')->truncate();
$admin_account = Config::get('cms::settings.admin_account');
$admin_settings = array('role_id' => 1, 'lang' => Config::get('cms::settings.language'), 'editor' => 0, 'is_active' => 1);
$admin_user = array_merge($admin_account, $admin_settings);
$admin_user['password'] = Hash::make($admin_user['password']);
$admin = User::create($admin_user);
UserDetail::create(array('user_id' => $admin->id));
// RANDOM 50 USERS
// Faker data
$faker = Faker\Factory::create();
for ($i = 1; $i <= 50; $i++) {
$user_settings = array('role_id' => 4, 'username' => $faker->username, 'email' => $faker->email, 'password' => Hash::make($faker->word), 'lang' => Config::get('cms::settings.language'), 'editor' => 0, 'is_active' => 1);
$user = User::create($user_settings);
$details = array('firstname' => $faker->firstname, 'lastname' => $faker->lastname, 'gender' => $faker->randomElement(array('m', 'f')), 'city' => $faker->city, 'bio' => $faker->text, 'birth_date' => $faker->date('Y-m-d', '-18 years'));
$user->details()->create($details);
}
DB::statement('SET FOREIGN_KEY_CHECKS = 1');
// enable foreign key constraints
}
示例7: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
/*for ($i = 1; $i <= 2; $i++) {
$this->command->info('User '.$i);
DB::table('users')->insert(array (
"name" => $faker->userName,
"email" => $faker->unique()->safeEmail,
//"name" => 'embajada77',
//"email" => 'embajada77@gmail.com',
"password" => Hash::make('1234')
));
}*/
$users_array = array();
$tope = 5518;
$cronom = new cronometro();
$password = Hash::make('1234');
for ($i = 1; $i <= $tope; $i++) {
$users_array[$i] = array("name" => $faker->userName, "email" => $faker->unique()->safeEmail, "password" => $password);
$prcnt = ROUND($i * 100 / $tope, 2);
$string_time = $cronom->getTiempoTranscurrido() . ' ' . $cronom->EstimarTiempoRestante($prcnt);
$this->command->info($string_time . ' ' . $prcnt . '% User ' . $i . '/' . $tope);
}
DB::table('users')->insert($users_array);
}
示例8: register
public function register()
{
$mobile = Input::get('mobile');
$email = Input::get('email');
$password = Input::get('password');
//对密码进行hash加密
$password = Hash::make($password);
$user = new User();
$user->password = $password;
$user->last_login_time = time();
$user->last_login_ip = $this->getIP();
$user->lock = 0;
$user->user_type = 'business';
$user->add_time = time();
if ($user->save()) {
$uid = $user->id;
} else {
echo "user base Error";
exit;
}
$Buser = new BUser();
$Buser->uid = $uid;
$Buser->email = $email;
$Buser->mobile = $mobile;
$Buser->email_passed = 0;
$Buser->mobile_passed = 1;
if ($Buser->save()) {
echo "ok";
}
}
示例9: encriptar_contra
function encriptar_contra($contra = null)
{
if ($contra == null) {
$contra = str_random(10);
}
return \Hash::make($contra);
}
示例10: postRegister
public function postRegister()
{
$validationRules = array('email' => 'required|email|unique:users', 'password' => 'required|min:8|confirmed', 'type' => 'required');
$formValidator = Validator::make(Input::all(), $validationRules);
if ($formValidator->passes()) {
// creatting new user
$createUser = new User();
$createUser->email = Input::get('email');
$createUser->type = Input::get('type');
$createUser->password = Hash::make(Input::get('password'));
$createUser->status = 'OFF';
$createUser->save();
// checking to create if user is patient or physician
if ($createUser->type == 'PHYSICIAN') {
$createPhysisician = new Physician();
$createPhysisician->user_id = $createUser->id;
$createPhysisician->save();
}
if ($createUser->type == 'PATIENT') {
$createPatient = new Patient();
$createPatient->user_id = $createUser->id;
$createPatient->save();
}
return Redirect::to('user/login')->with('success', ' Account created, please login');
} else {
return Redirect::back()->withInput()->withErrors($formValidator);
}
}
示例11: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
/*
* Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('profesion')->nullable();
$table->string('especialidad');
$table->string('first_name');
$table->string('father_last_name');
$table->string('mother_last_name')->nullable();
$table->string('fuerza')->nullable();
$table->string('ci')->unique();
$table->string('exp');
$table->string('email')->unique();
$table->date('birthday');
$table->string('password', 60);
$table->enum('type', ['Admin', 'Cursante', 'Tutor']);
$table->string('grado')->nullable();
$table->rememberToken();
$table->timestamps();
});
*/
\DB::table('users')->insert(array('first_name' => 'Admin', 'father_last_name' => ' ', 'mother_last_name' => ' ', 'ci' => '000000', 'especialidad' => 'Admin', 'exp' => 'LP', 'type' => 'Admin', 'email' => 'admin@admin.com', 'birthday' => '1999-01-01', 'password' => \Hash::make('EAEN2015')));
}
示例12: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$ip = '10.168.56.1';
DB::table('users')->delete();
$users = [['username' => 'admin', 'email' => 'test@test.be', 'password' => Hash::make('test'), 'role' => 0, 'ip' => $ip]];
DB::table('users')->insert($users);
}
示例13: run
public function run()
{
//User::truncate();
DB::Table('users')->delete();
User::create(['email' => 'craig9@gmail.com', 'password' => Hash::make('password'), 'name' => 'craig']);
User::create(['email' => 'art@franklindirect.com.au', 'password' => Hash::make('password'), 'name' => 'david']);
}
示例14: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$application = Application::create(['name' => 'RYZR CMS']);
$application_url = ApplicationUrl::create(['application_id' => $application->id, 'domain' => 'ryzr-cms.dev', 'folder' => '']);
$user = User::create(['name' => 'admin', 'email' => 'admin@admin.com', 'password' => \Hash::make('password')]);
$role_global_admin = Role::create(['name' => 'global_admin', 'display_name' => 'Global Administrator', 'description' => 'User is the administrator of all applications', 'application_id' => $application->id]);
$role_admin = Role::create(['name' => 'admin', 'display_name' => 'Administrator', 'description' => 'User is the administrator of a given application', 'application_id' => $application->id]);
$role_user = Role::create(['name' => 'user', 'display_name' => 'User', 'description' => 'Standard user (authenticated)', 'application_id' => $application->id]);
$role_guest = Role::create(['name' => 'guest', 'display_name' => 'Guest', 'description' => 'Unauthenticated user', 'application_id' => $application->id]);
$basic_admin = Permission::create(['name' => 'basic-admin', 'display_name' => 'Basic Admin', 'description' => 'User can access basic admin features', 'section' => 'admin', 'application_id' => $application->id]);
$manage_own_permissions = Permission::create(['name' => 'manage-own-permissions', 'display_name' => 'Manage own permissions', 'description' => 'User can manage own permissions', 'section' => 'admin', 'application_id' => $application->id]);
$manage_permissions = Permission::create(['name' => 'manage-permissions', 'display_name' => 'Manage permissions', 'description' => 'User can manage permissions', 'section' => 'admin', 'application_id' => $application->id]);
$manage_groups = Permission::create(['name' => 'manage-roles', 'display_name' => 'Manage roles', 'description' => 'User can manage roles', 'section' => 'admin', 'application_id' => $application->id]);
$manage_users = Permission::create(['name' => 'manage-users', 'display_name' => 'Manage users', 'description' => 'User can manage users', 'section' => 'admin', 'application_id' => $application->id]);
$user->applications()->attach($application);
$role_global_admin->attachPermission($basic_admin);
$role_global_admin->attachPermission($manage_own_permissions);
$role_global_admin->attachPermission($manage_permissions);
$role_global_admin->attachPermission($manage_groups);
$role_global_admin->attachPermission($manage_users);
$role_admin->attachPermission($basic_admin);
$role_admin->attachPermission($manage_own_permissions);
$role_admin->attachPermission($manage_permissions);
$role_admin->attachPermission($manage_groups);
$role_admin->attachPermission($manage_users);
$user->attachRole($role_global_admin);
}
示例15: generate
/**
* Return captcha image
* @param number $maxChar
*/
public function generate($maxChar = 4)
{
// $characters = '23456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
$characters = 'ABCDEFGHKMNPQRST';
$captchaText = '';
for ($i = 0; $i < $maxChar; $i++) {
$captchaText .= $characters[rand(0, strlen($characters) - 1)];
}
strtoupper(substr(md5(microtime()), 0, 7));
\Session::put('captchaHash', \Hash::make($captchaText));
$image = imagecreate(30 * $maxChar, 35);
$background = imagecolorallocatealpha($image, 255, 255, 255, 1);
$textColor = imagecolorallocatealpha($image, 206, 33, 39, 1);
$x = 5;
$y = 20;
$angle = 0;
for ($i = 0; $i < 7; $i++) {
$fontSize = 16;
$text = substr($captchaText, $i, 1);
imagettftext($image, $fontSize, $angle, $x, $y, $textColor, public_path('/fonts/LibreBaskerville/librebaskerville-regular.ttf'), $text);
$x = $x + 17 + mt_rand(1, 10);
$y = mt_rand(18, 25);
$angle = mt_rand(0, 20);
}
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Pragma: no-cache');
header('Content-type: image/jpeg');
imagejpeg($image, null, 100);
imagedestroy($image);
}