CRUD Operation Prerequisites.

Before performing CRUD operations we need to do some of the basic tasks. These includes:- 1. Installing Laravel 2. Creating Laravel Project 3. Making Model 4. Migrating After that we are good to go for performing the operation.

Laravel the most popular PHP-based framework for creating database-driven apps is based on the MVC (Model-View-Controller) architecture and can be used for easily creating apps for making CRUD (Create, Retrieve, Update, Delete) operations in the database.

1. Installing Laravel The first and foremost thing we need to have Laravel and composer installed in our system. the command for installation is
composer global require “laravel/installer=~1.1”
if this does not works then we could just write
composer global require “laravel/installer”
and it would install the file.
2. Creating Laravel Project Then we need to create a project and for this, we need to type
composer create-project –prefer-dist laravel/laravel project_name “5.8.*”
If this does not works then we could just write
composer create-project –prefer-dist laravel/laravel project_name
it would create a Laravel project named blog (with the latest version).

3. Making Model and Migrating After the project is created we need to create the Model. For this we use command.

$ php artisan make:model Model_name -mcr or $ php artisan make:model Model_name -a

(Note:- Model name should begin with a capital letter) Here mcr is (migration controller resources) we can use m/c/r separately but for better convenience, we use a which can equivalently be used in place of “mcr”.

After the model is created we need to create the database and attach it. We can instruct for the database creation through codes or we can go to PHPMyAdmin, and there we can create the database and provide the name of the database in the .env file

After database creation, we need to migrate. Migrations allow to add or drop fields in the database without deleting the records already present. for this we use $ php artisan migrate We could also refresh migration using $ php artisan migrate:refresh

All the prerequisites to perform CRUD operations are completed and are ready to go. Now we can move to views to create the Html page and perform desired CRUD operations.

For CRUD Operation Detailed Explanation with Example. https://www.scmgalaxy.com/tutorials/crud-operation-detailed-explaination-with-example/

abhishek k
Tagged : / / / / / /
0 0 votes
Article Rating
Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] Explanation for the above operations is given in link below http://www.scmgalaxy.com/tutorials/crud-operation-prerequisites/ […]

1
0
Would love your thoughts, please comment.x
()
x