Categories

Thursday, November 21, 2024
#919814419350 therichposts@gmail.com
Laravel

How to Setup Laravel Default Login Authentication?

Laravel 7.2 routing with route group auth guard check with prefix

Setup Laravel Default Login Authentication

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

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

2 Comments

  • 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

Leave a Reply

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