CRUD operation with the help of Laravel Framework.

Basic requirements:-

  • Steps for installing Laravel Framework
  1. Open Command Prompt and type
composer create-project --prefer-dist laravel/laravel project_name "5.8.*"

in place of project_name you can choose any name.

2. once Installed finished type

composer create -project laravel/laravel project_name “version_name.*”

3. Mysql Database connection

4. In first way you have to find .env file in your project folder. Open that file and under you have to define your mysql database configuration like below.

you can define your own database which you have created in PHP my Admin page.

5. Migrate Table from Laravel to Mysql Database through terminal

php artisan make:migration create_crud_table –create=crud

This command will create migration file in database/migrations folder. In this file we have to define table column which we want to create in table. Below you can find migration file in which we have define table column.

In Database / migration folder we make our schema.

6. Once schema is made we have to migrate our schema through terminal

php artisan migrate

7. Now we have to make our model, view and controller for that we run this command,

php artisan make:model Project_name -mcr

8. In app folder we find our model

Here we put our database table.

9. Setting Route

10. Set Data in View File in Laravel

In resource/view we make a new folder name parent.blade.php

11. In App/Http/Controller folder we code for function that we call during create, edit, delete operations

11. Now in resource/views we make 4 folder name 1. create.blade.php 2. edit.blade.php 3. view.blade.php 4. index.blade.php

For create.blade.php code

For edit.blade.php code

For view.blade.php code

For index.blade.php code

12. Now we run our local server for this we type

php artisan serve

now we run our project on browser.

Tagged :
0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x