Saturday, May 24, 2025
HomePHPLaravel 11 CRUD Operation - PHPGurukul

Laravel 11 CRUD Operation – PHPGurukul


On this tutorial, we’ll learn to create a CRUD Operation utilizing Laravel 11.

Step 1: Set up Laravel

Step 2: Set Up Your Setting
Be certain that your MySQL database is correctly configured. In your .env file, configure the database connection:

Step 3: Create the MySQL desk (customers)

Desk construction for desk customers

Step 4:Create a balde file for knowledge insertion

replace.blade.php (assets/views/insert.blade.php)

Step 5: Create a Mannequin and migration
Create a mannequin that can correspond to the database desk you wish to insert knowledge into. You are able to do this utilizing the artisan command:

You outline the desk title and fields which might be mass assignable (e.g., firstnameLastName, emailId) on this mannequin.

app/Fashions/Customers.php

Step 6: Create a controller for dealing with person inputs and insert/learn/replace/delete the information into the database.

app/Http/Controllers/crudController.php

Step7: Add a Path to Deal with the Type Submission

Step 8: We’ve got already created crudController; now, we’ll add the operate to point out the inserted knowledge in that controller.

Step 9: Create a blade template to show/present knowledge.

replace.blade.php (assets/views/learn.blade.php)

Step 10: Add the routes to the routes/internet.php

Step 11: Create the Edit View

replace.blade.php (assets/views/replace.blade.php)

Step 12: Create the operate to fetch/learn the actual person’s knowledge within the crudController

Step 13: Create the operate to replace the actual person’s knowledge within the crudController.

Step 14: Outline Routes for replace.

Step 15: Create the operate to delete the actual person’s knowledge within the crudController.

Step 16: Outline Routes for deletion.

The right way to run the Script

1. Obtain the venture zip file

2. Extract the file and replica crud-app  folder

3. Paste inside root listing (for xampp xampp/htdocs, for wamp wamp/www, for lamp var/www/Html)

4. Run these instructions

PS C :> cd xampp/htdocs/crud-app

PS C:xampphtdocscrud-app> php artisan migrate

PS C:xampphtdocscrud-app> php artisan serve

8. After that, open the browser and run the script

http://127.0.0.1:8000/fetch


Script Demo

Laravel 11 CRUD Operation (Supply Code)

Measurement: 26.6 MB

Model: V 1.0

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments