Home Laravel 8 Laravel 8 – CRUD application Tutorial

Laravel 8 – CRUD application Tutorial

19 min read
0
0
22,365

Laravel is world famous php framework.it has various features.Laravel is a MVC architecture. In this tutorial will see how to make a crud application in Laravel 8.Laravel 8 – CRUD application tutorial with Example. Here is the Best Place to Learn Laravel 8 Articles.

 

Lets do the Crud Step by Step Laravel 8 From Scratch

First Step

In computer create the folder Laravel Projects.and open the folder. and type the address bar on cmd

and Press Enter key and Open the Command Prompt.

Install Laravel 8

Create  a new Project type  the command on the command prompt  . I create the project name crudapplication
Laravel Tutorial  Setup the Project

After Type the Command you have to wait till the project has been created.

Database setup

Create the Database on xampp which name is crud

After created the database.

Change .env File

Change .env File for username, password and DB Name

Remove mb4 from Charset (config/database.php) // MySQL Version < 6

After that run check the application the welcome screen of Laravel framework look like this.

Create Migration

Create the tables

After that you can check the inside  database folder migrations  create_contacts_table.php

Click and open it.

then create the following fields

$table->string(‘name’);

$table->string(‘address’);

$table->string(‘mobile’);

inside the function up() function i shown in below clearly.

After add the lines type

Create Controller

Create the controller name which is CrudController 

Create Model

Model is used to get the data from the database.

Create the Model name which is Crud

After Model is Created the look like this. Code inside Model Class (app\Models\)

Change it as like this

Add the Namespace above

namespace App\Models;

Create Views

Create a Folder inside the resources-views

inside the views folder create the contacts folder

In Laravel you have create the pages using pagename.blade.php

Create page layout.blade.php

Create page index.blade.php

Add Records

Create page Create.blade.php

Edit Records

Create page edit.blade.php

Show Records

Create page show.blade.php

Controller

After that Pass All view pages through Controller. you have to add the Model namespace here

use App\Models\Contact;   Data is coming from the database via Model.

Routes

Pages are Manage through routes. If you are crud system simple you can add it the routes one line look like this

Route::resource(‘/contact’, ContactController::class);

You have to add the ControllerNameSpace

use App\Http\Controllers\ContactController;

i have attached the video link below. which will do this tutorials step by step.

 

 

 

 

Load More Related Articles
Load More By admin
Load More In Laravel 8

Leave a Reply

Your email address will not be published.

Check Also

Node js React Mongodb Search Functionality

In this articles will teach how to search records Node js React Express Mongodb.how the se…