Home Laravel 9 Laravel 9 Crud Step by Step

Laravel 9 Crud Step by Step

16 min read
0
0
15,087

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

Lets do the Crud Step by Step Laravel 9 From Scratch

First Step

Inside the project Folder Address Bar type cmd

and Press Enter key and Open the Command Prompt.

Install Laravel 9

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 basiccrud

After created the database.

Change .env File

Change .env File for username, password and DB Name

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

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_students_table.php

Click and open the Student table.

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

then table has been migrated

Create Controller

Create the controller name which is StudentController

Controller

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

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

Student Controller

Create Model

Model is used to get the data from the database.

Create the Model name which is Student

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 students folder

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

Create pages

layout.blade.php

index.blade.php

create.blade.php

edit.blade.php

show.blade.php

Routes

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

You have to add the ControllerNameSpace

use App\Http\Controllers\StudentController;

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 9

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…