Home Laravel How to Setup Laravel Default Login Authentication?

How to Setup Laravel Default Login Authentication?

by therichpost
Published: Updated: 2 comments
Laravel 7.2 routing with route group auth guard check with prefix

Hello to all, welcome to therichpost.com. In this post, I will tell you, How to Setup Laravel Default Login Authentication? Laravel is one of the top php mvc framework

Let’s Start the Authentication In laravel:

Laravel comes with Default Login Authentication, you just only run one command to add this and this is very easy and interesting.

Here is that command, first open your terminal and run below command:

php artisan make:auth

After run ablove command you can see, laravel will add all login related views itself and this is very good feature.

laravel-default-auth

After all this done, laravel route file has also been updated routes/web.php file:

laravel-routes-auth

Route:auth() method has all the login and registration routes.

Now you have all the views into your laravel and open your laravel project and you can easily see login and registration menu nav on your laravel project header.

login-laravel registration-laravel

Before login first you need to run to migrate command into your terminal and that command will create user auth related tables into your database and here is the command:

Also save your database details in your .env file then run below command:

php artisan migrate

If you will get any kind of error like “Syntax error or access violation: 1071” then check below link:

laravel migration error

Now after all this, you set your laravel project with default auth laravel feature.

There are so many code tricks in laravel and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

You may also like

2 comments

alexa April 2, 2018 - 7:38 am

laravel back() helper helps to user’s previous location

public function calendarSetting(Request $request)
{
if ($request->isMethod(‘post’))
{
$updateArr = [
‘value’ => serialize($request->provider),
‘updated_at’ => Carbon::now()->toDateTimeString()
];
$setting = DB::table(‘rv_setup’)
->where(‘user_id’,$this->userid)
->where(‘type’,’calender_settings’)
->update($updateArr);
if($setting) {
Session::flash(‘success’,’Settings updated successfully.’);
} else {
Session::flash(‘danger’,’Query failed, Please try again.’);
}
return back();
}

}

In php we use
header(‘Location: ‘.$url);

but laravel made easy

Reply
jasmeen May 29, 2018 - 4:01 am

nice tut 🙂

Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.