“Create Authentication Login and Registration in Laravel 5.8,Laravel 5.8 Login and Register Create using Auth Command”
Hello friends, today I will tell you through this tutorial that you can create a login or registration form by using auth command in laravel 5.8. So I will tell you step to step through this tutorial.
1.install laravel 5.8 project
2.Create User Model
3.Create Databse with users table
4.auth command run
5.Conclusion
1.install laravel 5.8 project
The first step is to install laravel 5.8. To install laravel 5.8 we first have to install the composer. If you have already installed the composer in your system or laptop. There is no need to install a composer.
composer create-project --prefer-dist laravel/laravel blog
2.Create User Model
Then after that we will create a database table model. To create a model we can create a model by using the laravel command. The systax to create the model is given below.
php artisan make:model User
App/User.php
<?php namespace App; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'first_name', 'email', 'password', 'password_confirmation', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; }
3.Create Databse with users table
CREATE TABLE `users` ( `id` int(100) NOT NULL, `first_name` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `remember_token` varchar(100) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` int(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=332;COMMIT;
4.auth command run
Now we will run the command auth by cmd. In laravel 5.8, auth command is run, the command is given below.
php artisan make:auth
I would like to tell you that after running an auth command, a auth name folder will be created in your views folder. In this you will get the login file and the blade file of register.
You can open these files via this url.
http://localhost/blog/public/login
http://localhost/blog/public/register
Login and Register Form show via Image
5.Conclusion