3 Steps to learn Laravel Easily | Laravel Crud Operation with Authentication

 Laravel is a strong MVC PHP framework, designed for developers who need a simple and elegant toolkit to bring full- featured web operations. Laravel was created by Taylor Otwell.


This article will guide the developers who want to learn easily Laravel through some simple steps.

3 Steps to learn Laravel Easily:
Step 1: Download laravel and Authentication Screen Setup
Run the following command to download Laravel Latest Vesrion - 
  • composer create-project laravel/laravel project-laravel
Atfer running the above command laravel project will be Downloaded in htdocs folder (Xampp)/ www folder (Wamp). then go in your project folder and run the following two command one by one to setup laravel default Authentication - 
  • composer require laravel/ui
  • php artisan ui vue –auth
    Install Laravel Form Collective:
  •     composer require laravelcollective/html
Step 2: Connect Laravel Project to Database
In this tutorial I am going to use MySQL. So, at first I am going to create a Database "project_laravel". Then create two table name "users" and "subject" in this database.
Now go to your project folder and find .env file (located in your project root folder) and just open this file.


Replace the database name with your database name and user name keep as "root". That's it. Your are now successfully connected your project to MySql server.


Step 3: Create View, Model & Controller File.
  • Create Route in the web.php file
Route::resource('crud', 'App\Http\Controllers\SubjectController');
  • Create View File
go to project folder and create a blade file in resources>views. Suppose this blade file name "crud.blade.php". Data will be appends in this file.

Content of view file:
  • Create Model file
go to project folder and create a model file in app>Models. Suppose this Model file name "Subject.php". Subject related table entity and attribute will be defined here. model for users table will be automatically created while project downloaded. following command will generate the model file.
php artisan make:model Models\Subject

Content of Model file:



  • Create Controller file
go to project folder and create a model file in app>Http>Controllers. Suppose this Controller file name "SubjectController.php". crud related table entity and attribute will be defined here. Following command will generate the controller file.
php artisan make:controller SubjectController --resource

Content of Controller file:




EmoticonEmoticon