{"id":5433,"date":"2021-03-06T09:29:08","date_gmt":"2021-03-06T09:29:08","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5433"},"modified":"2021-03-09T09:14:05","modified_gmt":"2021-03-09T09:14:05","slug":"crud-operation-prerequisites","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/","title":{"rendered":"CRUD Operation Prerequisites."},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Before performing CRUD operations we need to do some of the basic tasks.                                           These includes:-                                                                                                                                    <strong>1. Installing Laravel                                                                                                                                        2. Creating Laravel Project                                                                                                          3. Making Model                                                                                                                               4. Migrating  <\/strong>                                                                                                                                            After that we are good to go for performing the operation. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. Installing Laravel<\/strong>                                                                                                                                                                                               The first and foremost thing we need to have <em>Laravel <\/em>and <em>composer <\/em>installed in our system. the command for installation is<br><em><strong>composer global require \u201claravel\/installer=~1.1\u201d<\/strong><\/em><br>if this does not works then we could just write<br><em><strong>composer global require \u201claravel\/installer\u201d<\/strong><\/em><br>and it would install the file.<br><strong>2. Creating Laravel Project<\/strong>                                                                                                                                         Then we need to create a project and for this, we need to type<br><strong><em>composer create-project \u2013prefer-dist laravel\/laravel <strong><em>project_name<\/em><\/strong><\/em><\/strong> <strong><em>\u201c5.8.*\u201d<\/em><\/strong><br>If this does not works then we could just write<br><strong><em>composer create-project \u2013prefer-dist laravel\/laravel project_name<\/em><\/strong><br>it would create a Laravel project named blog (with the latest version).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. Making Model<\/strong>  <strong>and Migrating<\/strong>                                                                                                                        After the project is created we need to create the Model.                                                                     For this we use command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>$ php artisan make:model Model_name -mcr<\/em><\/strong>  or                                                                                    <strong><em>$ php artisan make:model Model_name -a<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">(<strong>Note:-<\/strong> Model name should begin with a capital letter)                                        Here <strong><em>mcr <\/em><\/strong>is (migration controller resources)                                                         we can use m\/c\/r separately but for better convenience, we use <strong>&#8220;<em>a<\/em>&#8220;<\/strong> which can equivalently be used in place of  <strong>&#8220;mcr&#8221;<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 <em>PHPMyAdmin<\/em>,<em> <\/em>and there we can create the database and provide the name of the database in the <em>.env<\/em> file<\/p>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-16.png\" alt=\"\" class=\"wp-image-5435\" width=\"466\" height=\"440\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-16.png 621w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-16-300x283.png 300w\" sizes=\"auto, (max-width: 466px) 100vw, 466px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">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 <strong><em>$ php artisan migrate<\/em><\/strong>                                                                                                    We could also refresh migration using                                                                                                                                                                             <strong><em>$<\/em><\/strong> <strong><em>php artisan migrate:refresh<\/em><\/strong><\/p>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-17.png\" alt=\"\" class=\"wp-image-5438\" width=\"426\" height=\"269\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-17.png 568w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-17-300x189.png 300w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">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.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For CRUD Operation Detailed Explanation with Example. <a href=\"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-detailed-explaination-with-example\/\" data-type=\"URL\" data-id=\"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-detailed-explaination-with-example\/\">https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-detailed-explaination-with-example\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Before performing CRUD operations we need to do some of the basic tasks. These includes:- 1. Installing Laravel 2. Creating [&hellip;]<\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5049,156],"tags":[5072,5076,5074,5073,5075,5078,5077],"class_list":["post-5433","post","type-post","status-publish","format-standard","hentry","category-laravel","category-websites","tag-crud","tag-crud-basics","tag-crud-operation-prerequisite","tag-crud-operations","tag-crud-prerequisite","tag-how-to-crud","tag-operations-in-crud"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>CRUD Operation Prerequisites. - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CRUD Operation Prerequisites. - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"Before performing CRUD operations we need to do some of the basic tasks. These includes:- 1. Installing Laravel 2. Creating [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-06T09:29:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-09T09:14:05+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-16.png\" \/>\n<meta name=\"author\" content=\"abhishek k\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"abhishek k\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/\"},\"author\":{\"name\":\"abhishek k\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/143500a93b88a96d3c9602b3df804cb6\"},\"headline\":\"CRUD Operation Prerequisites.\",\"datePublished\":\"2021-03-06T09:29:08+00:00\",\"dateModified\":\"2021-03-09T09:14:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/\"},\"wordCount\":380,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/image-16.png\",\"keywords\":[\"crud\",\"crud basics\",\"crud operation prerequisite\",\"crud operations\",\"crud prerequisite\",\"how to crud\",\"operations in crud\"],\"articleSection\":[\"Laravel\",\"Websites\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/\",\"name\":\"CRUD Operation Prerequisites. - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/image-16.png\",\"datePublished\":\"2021-03-06T09:29:08+00:00\",\"dateModified\":\"2021-03-09T09:14:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/143500a93b88a96d3c9602b3df804cb6\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/#primaryimage\",\"url\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/image-16.png\",\"contentUrl\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/image-16.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/crud-operation-prerequisites\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CRUD Operation Prerequisites.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/143500a93b88a96d3c9602b3df804cb6\",\"name\":\"abhishek k\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g\",\"caption\":\"abhishek k\"},\"description\":\"Abhishek is a full-stack developer that provides the solution for the design and analysis of Website and Mobile Application. Expertise in HTML, CSS, JAVASCRIPT, LARAVEL.\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/abhishek\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CRUD Operation Prerequisites. - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/","og_locale":"en_US","og_type":"article","og_title":"CRUD Operation Prerequisites. - scmGalaxy","og_description":"Before performing CRUD operations we need to do some of the basic tasks. These includes:- 1. Installing Laravel 2. Creating [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/","og_site_name":"scmGalaxy","article_published_time":"2021-03-06T09:29:08+00:00","article_modified_time":"2021-03-09T09:14:05+00:00","og_image":[{"url":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-16.png","type":"","width":"","height":""}],"author":"abhishek k","twitter_card":"summary_large_image","twitter_misc":{"Written by":"abhishek k","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/"},"author":{"name":"abhishek k","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/143500a93b88a96d3c9602b3df804cb6"},"headline":"CRUD Operation Prerequisites.","datePublished":"2021-03-06T09:29:08+00:00","dateModified":"2021-03-09T09:14:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/"},"wordCount":380,"commentCount":1,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/#primaryimage"},"thumbnailUrl":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-16.png","keywords":["crud","crud basics","crud operation prerequisite","crud operations","crud prerequisite","how to crud","operations in crud"],"articleSection":["Laravel","Websites"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/","name":"CRUD Operation Prerequisites. - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/#primaryimage"},"thumbnailUrl":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-16.png","datePublished":"2021-03-06T09:29:08+00:00","dateModified":"2021-03-09T09:14:05+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/143500a93b88a96d3c9602b3df804cb6"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/#primaryimage","url":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-16.png","contentUrl":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/03\/image-16.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/crud-operation-prerequisites\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"CRUD Operation Prerequisites."}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/143500a93b88a96d3c9602b3df804cb6","name":"abhishek k","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7e05a074cc5eeb0b13b5768bbfd8f7793851f739965234dc5aaae590b9c8677f?s=96&d=mm&r=g","caption":"abhishek k"},"description":"Abhishek is a full-stack developer that provides the solution for the design and analysis of Website and Mobile Application. Expertise in HTML, CSS, JAVASCRIPT, LARAVEL.","url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/abhishek\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=5433"}],"version-history":[{"count":8,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5433\/revisions"}],"predecessor-version":[{"id":5502,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5433\/revisions\/5502"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=5433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=5433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=5433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}