Crud Operation in Laravel for Beginners | Step by Step CRUD Operation in Laravel 5.8

In this tutorial you will learn CRUD (Create Read Update Delete) operation with Laravel 5.8 Application for beginners. Step By Step Tutorial For Beginners and its application with practical example. You will get how to create simple insert update delete operation with Laravel 5.8 from scratch. Please follow this tutorial mentioned below.

First let’s go to install laravel project

After Installation setup database So go to the .env file and add the database credentials. lets go to .env folder and put database name and connect to database.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=crud-operation
DB_USERNAME=root
DB_PASSWORD=

Now migrate the table

Now, let’s create our first Laravel Model. In your terminal, run the following command:

Now Contact model and migration file created successully.

Open the database/migrations/xxxxxx_create_contacts_table migration file and update it as below.

Now i added the first_name, last_name, email, job_title, city and country fields in the contacts table.

Now migrate the table

Next to Open the app/Contact.php and update it:

Creating the Controller and Routes

After creating the model and migrated our database. Next to create the controller and the routes for working with the Contact model. In your terminal, run the below command:

Next to Open the app/Http/Controllers/ContactController.php file. This is the initial content:

Open the routes/web.php file and update it as below:

Step 6: Add Blade Files

1) layout.blade.php

2) index.blade.php

3) create.blade.php

4) edit.blade.php

Next to Open the resources\views\layout.blade.php file and update it as below.

Next to Open the resources\views\contacts\index.blade.php file and update it as below.

Next to Open the resources\views\contacts\create.blade.php file and update it as below.

Next to Open the resources\views\contacts\edit.blade.php file and update it as below.

Now run this code

php artisan serve

Go to your run below code

http://127.0.0.1:8000/contacts

Now Crud operation created successully….. ?

I hope it’s helpfull for you if you have any doubt please comment below. ?

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x