<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>crud operations Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/crud-operations/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/crud-operations/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Mon, 12 Jul 2021 09:27:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>CRUD OPERATIONS IN LARAVEL PHP FRAMEWORK</title>
		<link>https://www.scmgalaxy.com/tutorials/crud-operations-in-laravel-php-framework/</link>
					<comments>https://www.scmgalaxy.com/tutorials/crud-operations-in-laravel-php-framework/#respond</comments>
		
		<dc:creator><![CDATA[rishav]]></dc:creator>
		<pubDate>Sat, 20 Mar 2021 12:31:57 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[crud operations]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[laravel crud operations]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=5686</guid>

					<description><![CDATA[<p>Crud is simply the basis of any web/app development features. All we have to do on any web page is [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/crud-operations-in-laravel-php-framework/">CRUD OPERATIONS IN LARAVEL PHP FRAMEWORK</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="has-black-color has-cyan-bluish-gray-background-color has-text-color has-background has-medium-font-size wp-block-paragraph">Crud is simply the basis of any web/app development features. All we have to do on any web page is Creating, Reading, Deleting, or Updating the content and that is known as the acronym CRUD. In this blog, we learn about how we perform CRUD operation in Laravel 5.8(PHP framework).</p>



<h3 class="wp-block-heading">Step 0: Prerequisite</h3>



<ul class="wp-block-list"><li>Install <strong>xampp </strong>a PHP development environment. (Version 7.4 best suited for 5.8 Laravel)</li><li>Install <strong>composer</strong>(to install libraries of Php for any application).</li><li>Install <strong>VS code</strong>(Code-editor).</li></ul>



<h3 class="has-black-color has-text-color wp-block-heading">Step 1 : Download/install Laravel 5.8</h3>



<p class="wp-block-paragraph">Go to command prompt and then go to the xampp folder in C drive by cmd.<strong> [C:\xampp\htdocs\]</strong></p>



<p class="wp-block-paragraph">In cmd Run : </p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
composer create-project laravel/laravel=5.8 crud --prefer-dist
</pre></div>


<p class="wp-block-paragraph"><em>It will install laravel 5.8 in your xampp/htdocs folder, and the folder name in which the Laravel is installed is &#8220;crud&#8221;(You can change this name of the folder while writing the command in cmd)</em>.</p>



<h3 class="wp-block-heading">Step 2 : Create the Database </h3>



<p class="wp-block-paragraph">For the connection of the database first we have to run <strong><em>&#8220;xampp control pannel&#8221;</em></strong>. </p>



<p class="wp-block-paragraph">Then in action tag <em>start </em>the <strong>Apache</strong> and <strong>MySQL</strong>.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="668" height="434" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/Annotation-2021-03-20-165436.png" alt="" class="wp-image-5698" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/Annotation-2021-03-20-165436.png 668w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/Annotation-2021-03-20-165436-300x195.png 300w" sizes="(max-width: 668px) 100vw, 668px" /></figure>



<p class="wp-block-paragraph">and then click on <strong><em>Admin</em></strong> of <strong><em>MySQl</em></strong>. It will redirect to<span class="has-inline-color has-black-color"> <em>http://localhost/phpmyadmin</em></span>.</p>



<ul class="wp-block-list"><li>Go to the database.</li><li>Give the name of the database and  click create.</li></ul>



<h3 class="wp-block-heading">Step 3: Connection to the database.</h3>



<p class="wp-block-paragraph">In the <strong><em>.env file </em></strong>of the Laravel folder(named crud in this blog) open it with VS Code. Change your code to this.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=gurukul
DB_USERNAME=root
DB_PASSWORD=
</pre></div>


<p class="wp-block-paragraph">where database name should be the same as you created in step2. and change DB_USERNAME to root.</p>



<h3 class="wp-block-heading">Step 4 : Migration of the table(From Laravel to MySQL Database)</h3>



<p class="wp-block-paragraph">We can make table in MySQL using the Laravel. For this we have to run this following command in cmd.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
php artisan make:migration create_crud_table –-create=crud
</pre></div>


<p class="wp-block-paragraph">You can use any name of your table instead of <em><strong>create_crud_table</strong></em>. The above command is going to create a migration(PHP file by the name of the table) file in the <strong>database/migration</strong> folder.</p>



<p class="wp-block-paragraph">Edit the code and paste this : </p>



<figure class="wp-block-image size-large"><img decoding="async" width="997" height="678" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/mig2.png" alt="" class="wp-image-5702" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/mig2.png 997w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/mig2-300x204.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/mig2-768x522.png 768w" sizes="(max-width: 997px) 100vw, 997px" /><figcaption><strong>update the function up()</strong></figcaption></figure>



<p class="wp-block-paragraph">Now in the command prompt use the following command : </p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
php artisan migrate
</pre></div>


<h2 class="wp-block-heading">Step 5: Create a Model File in Laravel </h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
php artisan make:model Crud -m
</pre></div>


<p class="wp-block-paragraph">In cmd, use this command to create the model file(You can use any name instead of <strong>Crud </strong>while making other projects)</p>



<p class="wp-block-paragraph">It will add a <em><strong>Crud.php </strong></em>file in the <strong><em>app </em></strong>folder and in this file in a variable define the table column.</p>


<div class="wp-block-syntaxhighlighter-code aligncenter"><pre class="brush: php; title: ; notranslate">
&lt;?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Crud extends Model
{
    //
    protected $fillable = &#x5B;
            &#039;first_name&#039;, &#039;last_name&#039;, &#039;image&#039;
        ];
}
</pre></div>


<h3 class="wp-block-heading">Step 6 : Creating the controller</h3>



<p class="wp-block-paragraph">Controller is used to handling the http request. They are stored in <strong>app/http/Controllers </strong>directory.</p>



<p class="wp-block-paragraph">We have to create the controller using the command line: </p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
php artisan make:model Crud -m
</pre></div>


<h5 class="wp-block-heading">Note : For making CrudController file in controllers </h5>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
php artisan make:controller CrudsController
</pre></div>


<h3 class="wp-block-heading">Step 7 : Setting the Route</h3>



<p class="wp-block-paragraph">Setting the route of all the CrudController class method in <strong><em>route/web.php</em></strong></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
Route::get(&#039;/&#039;, function () {
    return view(&#039;welcome&#039;);
});

Route::resource(&#039;crud&#039;, &#039;CrudController&#039;);
</pre></div>


<p class="wp-block-paragraph">This is very important method. </p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/crud-operations-in-laravel-php-framework/">CRUD OPERATIONS IN LARAVEL PHP FRAMEWORK</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/crud-operations-in-laravel-php-framework/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CRUD operation with the help of Laravel Framework.</title>
		<link>https://www.scmgalaxy.com/tutorials/crud-operation-with-the-help-of-laravel-framework/</link>
					<comments>https://www.scmgalaxy.com/tutorials/crud-operation-with-the-help-of-laravel-framework/#respond</comments>
		
		<dc:creator><![CDATA[Deepak K]]></dc:creator>
		<pubDate>Fri, 19 Mar 2021 09:44:26 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[crud operations]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=5640</guid>

					<description><![CDATA[<p>Basic requirements:- Composer (Link for Download Composer) Laravel framework Code Editor (Take any as per your choice, I prefer Visual [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/crud-operation-with-the-help-of-laravel-framework/">CRUD operation with the help of Laravel Framework.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Basic requirements:-</p>



<ul class="wp-block-list"><li>Composer (<a rel="noreferrer noopener" href="https://getcomposer.org/Composer-Setup.exe)" target="_blank">Link for Download Composer</a>)</li><li>Laravel framework </li><li>Code Editor (Take any as per your choice, I prefer <a rel="noreferrer noopener" href="https://code.visualstudio.com/download" target="_blank">Visual Studio</a>)</li><li><a rel="noreferrer noopener" href="https://www.apachefriends.org/download.html" target="_blank">XAMPP</a> for local host (You can also choose any for local host)</li></ul>



<ul class="wp-block-list"><li>Steps for installing Laravel Framework</li></ul>



<ol class="wp-block-list"><li>Open Command Prompt and type</li></ol>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
composer create-project --prefer-dist laravel/laravel project_name &quot;5.8.*&quot;
</pre></div>


<p class="wp-block-paragraph">in place of <strong>project_name </strong>you can choose any name.</p>



<p class="wp-block-paragraph">2. once Installed finished type </p>



<p class="wp-block-paragraph">composer create -project laravel/laravel project_name “version_name.*”</p>



<p class="wp-block-paragraph">3. Mysql Database connection</p>



<p class="wp-block-paragraph">4. In first way you have to find&nbsp;<strong>.env</strong>&nbsp;file in your project folder. Open that file and under you have to define your mysql database configuration like below.</p>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image size-large"><img decoding="async" width="200" height="148" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/1.png" alt="" class="wp-image-5641"/></figure>



<p class="wp-block-paragraph">you can define your own database which you have created in PHP my Admin page.</p>



<p class="wp-block-paragraph">5. Migrate Table from Laravel to Mysql Database through terminal</p>



<p class="wp-block-paragraph">php artisan make:migration create_crud_table –create=crud</p>



<p class="wp-block-paragraph">This command will create migration file in&nbsp;<strong>database/migrations</strong>&nbsp;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.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="860" height="455" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-35.png" alt="" class="wp-image-5643" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-35.png 860w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-35-300x159.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-35-768x406.png 768w" sizes="auto, (max-width: 860px) 100vw, 860px" /></figure>



<p class="wp-block-paragraph">In Database / migration folder we make our schema.</p>



<p class="wp-block-paragraph">6. Once schema is made we have to migrate our schema through terminal</p>



<p class="wp-block-paragraph">php artisan migrate</p>



<p class="wp-block-paragraph">7. Now we have to make our model, view and controller for that we run this command,</p>



<p class="wp-block-paragraph">php artisan make:model Project_name -mcr</p>



<p class="wp-block-paragraph">8. In app folder we find our model</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="457" height="291" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-36.png" alt="" class="wp-image-5645" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-36.png 457w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-36-300x191.png 300w" sizes="auto, (max-width: 457px) 100vw, 457px" /></figure>



<p class="wp-block-paragraph">Here we put our database table.</p>



<p class="wp-block-paragraph">9. Setting Route</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="636" height="408" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-37.png" alt="" class="wp-image-5646" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-37.png 636w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-37-300x192.png 300w" sizes="auto, (max-width: 636px) 100vw, 636px" /></figure>



<p class="wp-block-paragraph">10. Set Data in View File in Laravel</p>



<p class="wp-block-paragraph">In resource/view we make a new folder name parent.blade.php</p>



<script src="https://gist.github.com/dk5202000/e59f75f3bd3d6d77ee29728621dd94a3.js"></script>



<p class="wp-block-paragraph">11. In App/Http/Controller folder we code for function that we call during create, edit, delete operations</p>



<script src="https://gist.github.com/dk5202000/990011056ebcee11652fa0ac9ef8e978.js"></script>



<p class="wp-block-paragraph">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</p>



<p class="wp-block-paragraph">For create.blade.php code</p>



<script src="https://gist.github.com/dk5202000/db465f1e37779ffe7f2e847de8f21831.js"></script>



<p class="wp-block-paragraph">For edit.blade.php code</p>



<script src="https://gist.github.com/dk5202000/0df27b10aa12d820cfa354b98e7ac733.js"></script>



<p class="wp-block-paragraph">For view.blade.php code</p>



<script src="https://gist.github.com/dk5202000/16c8729afd7ce51d56d3df6bf7ebb302.js"></script>



<p class="wp-block-paragraph">For index.blade.php code</p>



<script src="https://gist.github.com/dk5202000/56ba8f55260abb6c9c4a2f394d94d7ba.js"></script>



<p class="wp-block-paragraph">12. Now we run our local server for this we type </p>



<p class="wp-block-paragraph">php artisan serve</p>



<p class="wp-block-paragraph">now we run our project on browser.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/crud-operation-with-the-help-of-laravel-framework/">CRUD operation with the help of Laravel Framework.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/crud-operation-with-the-help-of-laravel-framework/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CRUD Operation Prerequisites.</title>
		<link>https://www.scmgalaxy.com/tutorials/crud-operation-prerequisites/</link>
					<comments>https://www.scmgalaxy.com/tutorials/crud-operation-prerequisites/#comments</comments>
		
		<dc:creator><![CDATA[abhishek k]]></dc:creator>
		<pubDate>Sat, 06 Mar 2021 09:29:08 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[crud]]></category>
		<category><![CDATA[crud basics]]></category>
		<category><![CDATA[crud operation prerequisite]]></category>
		<category><![CDATA[crud operations]]></category>
		<category><![CDATA[crud prerequisite]]></category>
		<category><![CDATA[how to crud]]></category>
		<category><![CDATA[operations in crud]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=5433</guid>

					<description><![CDATA[<p>Before performing CRUD operations we need to do some of the basic tasks. These includes:- 1. Installing Laravel 2. Creating [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/crud-operation-prerequisites/">CRUD Operation Prerequisites.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<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>



<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>



<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 “laravel/installer=~1.1”</strong></em><br>if this does not works then we could just write<br><em><strong>composer global require “laravel/installer”</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 –prefer-dist laravel/laravel <strong><em>project_name</em></strong></em></strong> <strong><em>“5.8.*”</em></strong><br>If this does not works then we could just write<br><strong><em>composer create-project –prefer-dist laravel/laravel project_name</em></strong><br>it would create a Laravel project named blog (with the latest version).</p>



<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>



<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>



<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>



<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>



<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>



<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>



<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>



<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>



<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>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/crud-operation-prerequisites/">CRUD Operation Prerequisites.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/crud-operation-prerequisites/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
