Laravel 11 CRUD Example Tutorial

Laravel 11 CRUD Example Tutorial

In this tutorial, We will explain to you how to create laravel 11 crud example tutorial. we give information of the laravel 11 crud example from scratch for beginners.

Laravel is the most popular framework of PHP. laravel is better than other PHP frameworks because it handles the command base. so let us see about laravel 11 crud Operation example tutorial. it was released on March 12, 2024.

Now, we follow the below steps for creating the laravel 11 CRUD operation(Laravel 11 CRUD example). so you can see our laravel 11 tutorials.

Overview

Step 1: Install Laravel 11
Step 2: MySQL Database Configuration
Step 3: Create Migration
Step 4: Create Form Request Validation Class
Step 5: Create Controller and Model
Step 6: Add Resource Route
Step 7: Update AppServiceProvider
Step 8: Add Blade Files
Step 9: Run Laravel Application

Step 1: Install Laravel 11

We are going to create the Laravel 11 App and install laravel 11, so first open the command prompt or terminal and go to xampp htdocs folder directory using the command prompt. after then run the below command for laravel 11 install.

Step 2: MySQL Database Configuration

After the complete installation of laravel. we have to do database configuration. now we will open the .env file and change the database name, username, and password in the .env file. See below for changes in a .env file.

Step 3: Create Migration

Now, We need to create a migration. so we will below the command using create the students table migration.

After complete migration. we need below changes in the database/migrations/create_students_table file.

Run the below command. after the changes above file.

Step 4: Create Form Request Validation Class
in this step, we will create form validation class for create and update student form.
so first here create class for store(), below command using you can easily create class.

paste below code into your file.
app/Http/Requests/StudentStoreRequest.php

second class create for update(),below command using create it.

paste below code into your file.
app/Http/Requests/StudentUpdateRequest.php

Step 5: Create Controller and Model
Here below command help to create the controller and model.

in this file, we will create student model, and pass the ours fields in this model.
app/Models/Student.php

in this file, we will create student controller, we will create some method for crud operation. so you can follow below file.
app/Http/Controllers/StudentController.php

Step 6: Add Resource Route
We have to need put below student resource route in routes/web.php. so you can below routes file.

Step 7: Update AppServiceProvider
In this file, we will use the boostrap 5 and paginator. so you can see below file.
app/Provides/AppServiceProvider.php

Step 8: Add Blade Files

So finally, first we will create the new directory “resources/views/students/”. in this directory, we will create layout.blade.php, index.blade.php, create.blade.php, edit.blade.php and show.blade.php files.

resources/views/students/layout.blade.php

resources/views/students/index.blade.php

resources/views/students/create.blade.php

resources/views/students/edit.blade.php

resources/views/students/show.blade.php

Step 9: Run Laravel Application
We can start the server and run this example using the below command.

Now we will run our example using the below Url in the browser.

Download laravel 11 CRUD example from github

Please follow and like us: