本文整理汇总了PHP中Hash::Make方法的典型用法代码示例。如果您正苦于以下问题:PHP Hash::Make方法的具体用法?PHP Hash::Make怎么用?PHP Hash::Make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hash
的用法示例。
在下文中一共展示了Hash::Make方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postUpdateemp
public function postUpdateemp()
{
$inputs = Input::all();
$employee = Employee::find($inputs['id']);
if (is_object($employee)) {
$photoNewName = $employee->emp_image;
// upload photo
if (Input::hasFile('photo')) {
$photo = Input::file('photo');
$photoNewName = date('YmdHis') . '.' . $photo->getClientOriginalExtension();
if (file_exists('image/employee/' . $employee->emp_image)) {
File::delete('image/employee/' . $employee->emp_image);
}
$photo->move('image/employee', $photoNewName);
}
$employee->emp_name = $inputs['fullname'];
$employee->emp_idcard = $inputs['cardid'];
$employee->emp_address = $inputs['address'];
$employee->emp_tel = $inputs['tel'];
$employee->emp_lineid = $inputs['lineid'];
$employee->emp_email = $inputs['email'];
$employee->emp_image = $photoNewName;
$employee->emp_username = $inputs['username'];
$employee->emp_password = Hash::Make($inputs['password']);
$employee->save();
return Redirect::to('admin/employee/showallemployee')->with('alert', 'แก้ไขข้อมูลเรียบร้อยแล้ว');
}
}
示例2: postUpdate
public function postUpdate()
{
$inputs = Input::all();
$user = User::find($inputs['id']);
//หา Data ก่อน คำสั่ง find ใช้กับ id
if (is_object($user)) {
$user->username = $inputs['username'];
$user->password = !empty($inputs['password']) ? Hash::Make($inputs['password']) : $user->password;
$user->fullname = $inputs['fullname'];
$user->user_group = $inputs['group'];
$user->save();
return Redirect::to('admin/user')->with('message', 'Update Completed');
}
}
示例3: run
public function run()
{
/**
* Checks if the `comments` table exists.
* If it exists, delete it.
*/
if (Schema::hasTable('comments')) {
$this->command->info('Old table comments detected!');
Schema::drop('comments');
$this->command->info('Old table comments deleted!');
/**
* If after deletion the table still exists, then I'm fucked.
*/
if (Schema::hasTable('comments')) {
$this->command->info('Im fucked');
}
}
/**
* Checks if the `articles` table exists.
* If it exists, delete it.
*/
if (Schema::hasTable('articles')) {
$this->command->info('Old table articles detected!');
// DB::table('articles')->delete();
Schema::drop('articles');
$this->command->info('Old table articles deleted!');
/**
* If after deletion the table still exists, then I'm fucked.
*/
if (Schema::hasTable('articles')) {
$this->command->info('Im fucked');
}
}
/**
* Checks if the `users` table exists.
* If it exists, delete it.
*/
if (Schema::hasTable('users')) {
$this->command->info('Old table users detected!');
// DB::table('articles')->delete();
Schema::drop('users');
$this->command->info('Old table users deleted!');
/**
* If after deletion the table still exists, then I'm fucked.
*/
if (Schema::hasTable('users')) {
$this->command->info('Im fucked');
}
}
/**
* Recreate the articles table
*/
Schema::create('users', function ($table) {
$table->increments('id');
// $table->foreign('article_id')->references('id')->on('articles')->onDelete('cascade');
$table->string('name');
$table->string('email');
$table->string('password');
$table->string('remember_token');
$table->timestamps();
});
$this->command->info('Recreation of users succeeded!');
/**
* Recreate the articles table
*/
Schema::create('articles', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->string('title');
$table->string('content');
$table->timestamps();
});
$this->command->info('Recreation of articles succeeded!');
/**
* Recreate the comments table
*/
Schema::create('comments', function ($table) {
$table->increments('id');
$table->integer('article_id')->unsigned();
$table->foreign('article_id')->references('id')->on('articles')->onDelete('cascade');
$table->string('content');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->timestamps();
});
$this->command->info('Recreation of comments succeeded!');
/**
* Insert columns into the table.
*/
// Schema::table('articles', function($table)
// {
//
// });
User::create(['email' => 'foo@bar.com', 'name' => 'Hu Zheng', 'password' => Hash::Make('password')]);
User::create(['email' => 'foobar@bar.com', 'name' => 'Your Daddy', 'password' => Hash::Make('password')]);
Article::create(['title' => 'Hi!', 'user_id' => 1, 'content' => 'This is the very first article']);
Article::create(['title' => 'Hi!', 'user_id' => 2, 'content' => 'This is the very second article']);
Comment::create(['article_id' => 1, 'content' => 'This is the very first comment', 'user_id' => 1]);
Comment::create(['article_id' => 1, 'content' => 'This is the very second comment', 'user_id' => 2]);
//.........这里部分代码省略.........
示例4: generateHash
public static function generateHash()
{
return Hash::Make(md5(openssl_random_pseudo_bytes(10)));
}