Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

How to Create a Simple Login Authentication System in LARAVEL?Part-1

How to Create a Simple Login Authentication System in LARAVEL?

Firstly, we’ll create a new project for this.

Step 1. Go to XAMPP/htdocs folder -> right Click->Open Git Bash Here

Step 2. To Create a New Project in Laravel, write down the following command:

$ composer create-project --prefer-dist laravel/laravel CustomerService "5.8.*"Code language: JavaScript (javascript)

Step 3. To Go the current working Project directory, write down this following command:

$ cd CustomerService

It’ll be redirected to the current Project.

Mysql Database connection Laravel

Step 4. To Create a new Database so we have to Go to XAMPP server->phpMyAdmin->Click New Database-> customerservice.

Step 5. Thereafter, Open Sublime Text and Go to .env file to set the current project path and give the project APP_URL path, DB_DATABASE name and DB_USERNAME name.

Step 6. To Migrate the user table which is in-built in database/migrations/ to Mysql database. Write down the following command:

$ php artisan migrate

Step 7.  To Insert user records in users table by use of Laravel seeders.  Write down the following command:


$ php artisan make:seeder UsersTablesSeeder

Step 8. Now, Go to the database/seeds/UsersTablesSeeder.php and define single user data in the run() method.


       User::create([
            'name'    => 'Usha Kiran',
            'email'    => 'usha.cotocus@gmail.com',
            'password'   =>  Hash::make('password'),
            'remember_token' =>  str_random(10),
        ]);Code language: PHP (php)

Step 9. After that, Go to the database/seeds/DatabaseSeeder.php and call the UsersTablesSeeder.php class within the run() method.

Step 10. Here, we’ll Insert data into the UsersTablesSeeders. Write down the following command:

$ php artisan db:seeder

Inserted date into users table

Step 11. To Create a Controller in the app/Http/Controllers folder. Write down the following command:

$ php artisan make:controller MainController --resource

Step 12. After that, we need to load the login form, write this code within the index() method.

 public function index()
    {
        return view('login');
    }Code language: PHP (php)

Step 13. So, Create login.blade.php file in resources/views to display

Step 14. Thereafter, Go to routes/web.php file and we’ll set route request.

Route::get('/login', 'MainController@index');Code language: PHP (php)
Login Page

Thanks

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
With MotoShare.in, you can book a bike instantly, enjoy doorstep delivery, and ride without worries. Perfect for travelers, professionals, and adventure enthusiasts looking for a seamless mobility solution.

Related Posts

What is CodeIgniter and use cases of CodeIgniter?

What is CodeIgniter? CodeIgniter is an open-source PHP web application framework designed to simplify and accelerate web development. It follows the Model-View-Controller (MVC) architectural pattern and provides…

Read More

What is PHP and use cases of PHP?

What is PHP? Are you wondering what PHP is and how it works? Look no further! In this article, we will explore the ins and outs of…

Read More

Complete guide on PHP certification courses, tutorials & training

What is PHP Hypertext Preprocessor is known as PHP. Many developers use PHP, an open-source server-side programming language, to create websites. In addition, it is a general-purpose…

Read More

Complete PHP with Laravel Certification Guide & tutorials

What is PHP with Laravel? PHP was visioned eventually in the fall of 1994 by Rasmus Lerdorf. PHP means Hypertext Preprocessor. It’s a extensively- used, open source…

Read More

Top 50 PHP Interview Questions and Answers

1) What is PHP? PHP is an open-source, interpreted, and object-oriented scripting language that can be executed at the server-side. PHP is well suited for web development….

Read More

Complete guide of PHP certification courses, tutorials & training

PHP is a great beginner programming language for anyone who is wanting to cross over into the coding world. Though easy to learn, it is an extremely…

Read More