Hashing passwords and other data
It's common practice to hash a user's password when we store it in a database. This helps prevent anyone who gets unauthorized access to the database from seeing people's passwords. However, we may also want to hide our user's e-mail address or other information, so no one will be able to access them as well. We can use Laravel's Hash to do this easily.
Getting ready
For this recipe, we need a standard installation of Laravel, as well as a properly set-up and configured MySQL database.
How to do it...
Here are the steps for this recipe…
Set up the database table by using the following commands:
CREATE TABLE register ( id int(10) unsigned NOT NULL AUTO_INCREMENT, username varchar(255) DEFAULT NULL, email char(60) DEFAULT NULL, password char(60) DEFAULT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=1
In the
views
directory, create a file named asregister.php
with the help of the following code:<!doctype html> <html lang="en">...