<?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 operation in laravel Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/crud-operation-in-laravel/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/crud-operation-in-laravel/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Wed, 13 Apr 2022 16:33:34 +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>How to Install Laravel and Create first View Page in Laravel ?</title>
		<link>https://www.scmgalaxy.com/tutorials/how-to-install-laravel-and-create-first-view-page-in-laravel/</link>
					<comments>https://www.scmgalaxy.com/tutorials/how-to-install-laravel-and-create-first-view-page-in-laravel/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Tue, 06 Jul 2021 11:03:33 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[crud operation in laravel]]></category>
		<category><![CDATA[Laravel beginners]]></category>
		<category><![CDATA[laravel project setup]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6676</guid>

					<description><![CDATA[<p>In this tutorial im going to describe how to install laravel project and create first view pages, so follow some [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-install-laravel-and-create-first-view-page-in-laravel/">How to Install Laravel and Create first View Page in Laravel ?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1200/1*A42wBEcxc4L46-DO2cancg.jpeg" alt=""/></figure>



<p class="wp-block-paragraph" id="661f">In this tutorial im going to describe how to install laravel project and create first view pages, so follow some easy steps define below.</p>



<h1 class="wp-block-heading" id="cd8b">First let’s go to install laravel project</h1>



<pre class="wp-block-preformatted">composer create-project laravel/laravel learning-project "5.8.*"</pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><em>lets go to&nbsp;</em><strong><em>.env folder</em></strong><em>&nbsp;and put database name and connect to database.</em></p></blockquote>



<pre class="wp-block-preformatted">DB_CONNECTION=mysql<br>DB_HOST=127.0.0.1<br>DB_PORT=3306<br>DB_DATABASE=learning-project<br>DB_USERNAME=root<br>DB_PASSWORD=</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/700/1*iXRjngBRGaYs5_7kRwSqcQ.png" alt=""/></figure>



<h1 class="wp-block-heading" id="be24">Now migrate the table</h1>



<pre class="wp-block-preformatted">php artisan migrate</pre>



<p class="wp-block-paragraph" id="c540">Now Open your project and go to Resouces/view folder and create folllowing files</p>



<pre class="wp-block-preformatted">create.blade.php<br>dashboard.blade.php<br>home.blade.php<br>blog.blade.php</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/686/1*IurixvE_OL9vn5ki_yEqvA.png" alt=""/></figure>



<p class="wp-block-paragraph" id="72ed">Go to create.blade.php and paste below code</p>



<pre class="wp-block-preformatted">&lt;h1&gt;this is create pages&lt;/h1&gt;</pre>



<p class="wp-block-paragraph" id="a62d">Next go to dashboard.blade.php and paste below code</p>



<pre class="wp-block-preformatted">&lt;h1&gt;this is dashboard pages&lt;/h1&gt;</pre>



<p class="wp-block-paragraph" id="f2b2">Now create blog.blade.php file and paste below lines.</p>



<pre class="wp-block-preformatted">&lt;h1&gt;this is blog pages&lt;/h1&gt;</pre>



<p class="wp-block-paragraph" id="6870">Next go to Route/web.php and add below line</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p><em>Go to Route/web.php</em></p></blockquote>



<pre class="wp-block-preformatted">&lt;?php<br><br>/*<br>|--------------------------------------------------------------------------<br>| Web Routes<br>|--------------------------------------------------------------------------<br>|<br>| Here is where you can register web routes for your application. These<br>| routes are loaded by the RouteServiceProvider within a group which<br>| contains the "web" middleware group. Now create something great!<br>|<br>*/<br><br>Route::get('/', function () {<br>    return view('welcome');<br>});<br><br>Route::get('/dashboard', function (){<br>    return view('dashboard');<br>});<br><br>Route::get('/create', function (){<br>    return view('create');<br>});<br><br>Route::get('/blog', function (){<br>    return view('blog');<br>});</pre>



<p class="wp-block-paragraph" id="6c37">And last one serve below code in your terminal.</p>



<pre class="wp-block-preformatted">php artisan serve</pre>



<p class="wp-block-paragraph" id="3a7b">Copy below url and paste in your browser.</p>



<pre class="wp-block-preformatted"><a href="http://127.0.0.1:8000/blog">http://127.0.0.1:8000/blog</a></pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/700/1*-sXdphMWLTc4KtkfRoqg9g.png" alt=""/></figure>



<pre class="wp-block-preformatted"><a href="http://127.0.0.1:8000/blog">http://127.0.0.1:8000/c</a>reate</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/700/1*zdWOoUT7lxSIh2I9xL5jEw.png" alt=""/></figure>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/700/1*XSIz5QMu5nTwLgyC_a4iOg.png" alt=""/></figure>



<p class="wp-block-paragraph" id="620a">Thank i hope its helpfull for you. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a href="https://laravelamit.medium.com/?source=post_sidebar--------------------------post_sidebar-----------">Amit Kumar</a></p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-install-laravel-and-create-first-view-page-in-laravel/">How to Install Laravel and Create first View Page in Laravel ?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/how-to-install-laravel-and-create-first-view-page-in-laravel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Multi File upload with Image preview and checklist delete options</title>
		<link>https://www.scmgalaxy.com/tutorials/multi-file-upload-with-image-preview-and-checklist-delete-options/</link>
					<comments>https://www.scmgalaxy.com/tutorials/multi-file-upload-with-image-preview-and-checklist-delete-options/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Sat, 19 Jun 2021 06:06:43 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[crud operation in laravel]]></category>
		<category><![CDATA[image upload and preview]]></category>
		<category><![CDATA[imageupload]]></category>
		<category><![CDATA[laravel]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6535</guid>

					<description><![CDATA[<p>In this tutorial i’m going to describe how to upload multiple image with crud operation edit, update delete in laravel. [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/multi-file-upload-with-image-preview-and-checklist-delete-options/">Multi File upload with Image preview and checklist delete options</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/600/1*nrL53tHUFEEZEzBMucOohQ.jpeg" alt=""/></figure>



<p class="wp-block-paragraph" id="42ab">In this tutorial i’m going to describe how to upload multiple image with crud operation edit, update delete in laravel. Image upload is necessary of every project. In this project i’m going to learn how to upload with validation like images, mimes, max file upload and etc, with image preview when uploading image and adding features checklist delete.</p>



<p class="wp-block-paragraph" id="091a">So let’s go to download project and configure</p>



<p class="wp-block-paragraph" id="9e9e">Please follow some easy steps define below.</p>



<h1 class="wp-block-heading" id="9d03">First let’s go to install laravel project</h1>



<pre class="wp-block-preformatted">composer create-project laravel/laravel admin-dashboard "5.8.*"</pre>



<p class="wp-block-paragraph" id="7131">After Installation setup database So go to the&nbsp;<strong>.env&nbsp;</strong>file and add the database credentials.&nbsp;<em>lets go to&nbsp;</em><strong><em>.env folder</em></strong><em>&nbsp;and put database name and connect to database.</em></p>



<pre class="wp-block-preformatted">DB_CONNECTION=mysql<br>DB_HOST=127.0.0.1<br>DB_PORT=3306<br>DB_DATABASE=admin-dashboard<br>DB_USERNAME=root<br>DB_PASSWORD=</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1043/0*jHgSQWVvf6c20U7h.png" alt=""/></figure>



<h1 class="wp-block-heading" id="b6e5">Now migrate the table</h1>



<pre class="wp-block-preformatted">php artisan migrate</pre>



<p class="wp-block-paragraph" id="deb8">Next step: Add Resource Route Go to your route and paste below code <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">use App\Http\Controllers\ProductController;<br>Route::resource('products', ProductController::class);</pre>



<p class="wp-block-paragraph" id="84fc">Now lets go to create controller, model and migration file go to your terminal and paste below code</p>



<pre class="wp-block-preformatted">php artisan make:model ProductController -mcr</pre>



<p class="wp-block-paragraph" id="f3d4">Lets go to your migration file productstable and paste below code. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">&lt;?phpuse Illuminate\Support\Facades\Schema;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Database\Migrations\Migration;class CreateProductsTable extends Migration<br>{<br>    /**<br>     * Run the migrations.<br>     *<br>     * @return void<br>     */<br>    public function up()<br>    {<br>        Schema::create('products', function (Blueprint $table) {<br>            $table-&gt;bigIncrements('id');<br>            $table-&gt;string('name');<br>            $table-&gt;string('detail');<br>            $table-&gt;string('image');<br>            $table-&gt;timestamps();<br>        });<br>    }    /**<br>     * Reverse the migrations.<br>     *<br>     * @return void<br>     */<br>    public function down()<br>    {<br>        Schema::dropIfExists('products');<br>    }<br>}</pre>



<p class="wp-block-paragraph" id="9b30">Now migrate the table <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">php artisan migrate</pre>



<p class="wp-block-paragraph" id="0e59">Next go to Your ProductController file and paste below code <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">&lt;?php<br>  <br>namespace App\Http\Controllers;<br>  <br>use App\Product;<br>use Illuminate\Http\Request;<br>  <br>class ProductController extends Controller<br>{<br>    /**<br>     * Display a listing of the resource.<br>     *<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function index()<br>    {<br>        $products = Product::latest()-&gt;paginate(5);<br>    <br>        return view('products.index',compact('products'))<br>            -&gt;with('i', (request()-&gt;input('page', 1) - 1) * 5);<br>    }<br>   <br>    /**<br>     * Show the form for creating a new resource.<br>     *<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function create()<br>    {<br>        return view('products.create');<br>    }<br>    <br>    /**<br>     * Store a newly created resource in storage.<br>     *<br>     * @param  \Illuminate\Http\Request  $request<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function store(Request $request)<br>    {<br>        $request-&gt;validate([<br>            'name' =&gt; 'required',<br>            'name' =&gt; 'required',<br>            'detail' =&gt; 'required',<br>            'image' =&gt; 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',<br>        ]);<br>  <br>        $input = $request-&gt;all();<br>  <br>        if ($image = $request-&gt;file('image')) {<br>            $destinationPath = 'image/';<br>            $profileImage = date('YmdHis') . "." . $image-&gt;getClientOriginalExtension();<br>            $image-&gt;move($destinationPath, $profileImage);<br>            $input['image'] = "$profileImage";<br>        }<br>    <br>        Product::create($input);<br>     <br>        return redirect()-&gt;route('products.index')<br>                        -&gt;with('success','Product created successfully.');<br>    }<br>     <br>    /**<br>     * Display the specified resource.<br>     *<br>     * @param  \App\Product  $product<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function show(Product $product)<br>    {<br>        return view('products.show',compact('product'));<br>    }<br>     <br>    /**<br>     * Show the form for editing the specified resource.<br>     *<br>     * @param  \App\Product  $product<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function edit(Product $product)<br>    {<br>        return view('products.edit',compact('product'));<br>    }<br>    <br>    /**<br>     * Update the specified resource in storage.<br>     *<br>     * @param  \Illuminate\Http\Request  $request<br>     * @param  \App\Product  $product<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function update(Request $request, Product $product)<br>    {<br>        $request-&gt;validate([<br>            'name' =&gt; 'required',<br>            'detail' =&gt; 'required'<br>        ]);<br>  <br>        $input = $request-&gt;all();<br>  <br>        if ($image = $request-&gt;file('image')) {<br>            $destinationPath = 'image/';<br>            $profileImage = date('YmdHis') . "." . $image-&gt;getClientOriginalExtension();<br>            $image-&gt;move($destinationPath, $profileImage);<br>            $input['image'] = "$profileImage";<br>        }else{<br>            unset($input['image']);<br>        }<br>          <br>        $product-&gt;update($input);<br>    <br>        return redirect()-&gt;route('products.index')<br>                        -&gt;with('success','Product updated successfully');<br>    }<br>  <br>    /**<br>     * Remove the specified resource from storage.<br>     *<br>     * @param  \App\Product  $product<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function destroy(Product $product)<br>    {<br>        $product-&gt;delete();<br>     <br>        return redirect()-&gt;route('products.index')<br>                        -&gt;with('success','Product deleted successfully');<br>    }<br><br>    <br>}</pre>



<p class="wp-block-paragraph" id="405e">Next go to your Model</p>



<p class="wp-block-paragraph" id="5704"><strong>app/Models/Product.php</strong></p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App;<br><br>use Illuminate\Database\Eloquent\Model;<br><br>class Product extends Model<br>{<br>    protected $fillable =[<br>        'name', 'detail', 'image'<br>    ];<br>}</pre>



<p class="wp-block-paragraph" id="f32a">Now create some file as define below.</p>



<p class="wp-block-paragraph" id="3d1c">Go to your resources/view folder and create following files inside the products folder as define below file like</p>



<pre class="wp-block-preformatted">1) layout.blade.php<br>2) index.blade.php<br>3) create.blade.php<br>4) edit.blade.php<br>5) show.blade.php</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/614/1*T0m2I_ps3jYIQpePv6WM-w.png" alt=""/></figure>



<p class="wp-block-paragraph" id="9a1a">Next go to resouce/view/products/layout file and paste below code</p>



<p class="wp-block-paragraph" id="edc6">Go to your app.blade.php file and paste below code</p>



<pre class="wp-block-preformatted">&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;Multiple Image upload with crud by Laravel Amit&lt;/title&gt;<br>    &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css" rel="stylesheet"&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  <br>&lt;div class="container"&gt;<br>    @yield('content')<br>&lt;/div&gt;<br>   <br>&lt;/body&gt;<br>&lt;/html&gt;</pre>



<p class="wp-block-paragraph" id="c7f5">Next go to products/index.blade.php and paste below code</p>



<pre class="wp-block-preformatted">@extends('products.layout')
@section('content')
&lt;br&gt;&lt;br&gt;
&lt;div class="container" style="margin-right: -50px;"&gt;
   &lt;div class="row"&gt;
      &lt;div class="col-lg-12 margin-tb"&gt;
         &lt;div class="pull-left"&gt;
            &lt;h2&gt;Multiple Image upload with crud by Laravel Amit&lt;/h2&gt;
         &lt;/div&gt;
         &lt;div class="pull-right"&gt;
            &lt;a class="btn btn-success" href="{{ route('products.create') }}"&gt; Create New Product&lt;/a&gt;
         &lt;/div&gt;
      &lt;/div&gt;
   &lt;/div&gt;
   @if ($message = Session::get('success'))
   &lt;div class="alert alert-success"&gt;
      &lt;p&gt;{{ $message }}&lt;/p&gt;
   &lt;/div&gt;
   @endif
   &lt;table class="table table-bordered"&gt;
      &lt;tr&gt;
         &lt;th width="50px"&gt;&lt;input type="checkbox" id="master"&gt;&lt;/th&gt;
         &lt;th&gt;No&lt;/th&gt;
         &lt;th&gt;Image&lt;/th&gt;
         &lt;th&gt;Name&lt;/th&gt;
         &lt;th&gt;Email&lt;/th&gt;
         &lt;th&gt;Details&lt;/th&gt;
         &lt;th width="280px"&gt;Action&lt;/th&gt;
      &lt;/tr&gt;
      @foreach ($products as $product)
      &lt;tr&gt;
         &lt;td&gt;&lt;input type="checkbox" class="sub_chk" data-id="{{$product-&gt;id}}"&gt;&lt;/td&gt;
         &lt;td&gt;{{ ++$i }}&lt;/td&gt;
         &lt;td&gt;&lt;img src="/image/{{ $product-&gt;image }}" width="100px"&gt;&lt;/td&gt;
         &lt;td&gt;{{ $product-&gt;name }}&lt;/td&gt;
         &lt;td&gt;{{ $product-&gt;email }}&lt;/td&gt;
         &lt;td&gt;{{ $product-&gt;detail }}&lt;/td&gt;
         &lt;td&gt;
            &lt;form action="{{ route('products.destroy',$product-&gt;id) }}" method="POST"&gt;
               &lt;a class="btn btn-info" href="{{ route('products.show',$product-&gt;id) }}"&gt;Show&lt;/a&gt;
               &lt;a class="btn btn-primary" href="{{ route('products.edit',$product-&gt;id) }}"&gt;Edit&lt;/a&gt;
               @csrf
               @method('DELETE')
               &lt;button type="submit" class="btn btn-danger"&gt;Delete&lt;/button&gt;
            &lt;/form&gt;
         &lt;/td&gt;
      &lt;/tr&gt;
      @endforeach
   &lt;/table&gt;
   {!! $products-&gt;links() !!}
&lt;/div&gt;
@endsection</pre>



<pre class="wp-block-preformatted">Next create files inside the products folder <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></pre>



<pre class="wp-block-preformatted">create.blade.php</pre>



<p class="wp-block-paragraph" id="ff15">Go to create.blade.php file and paste below code</p>



<pre class="wp-block-preformatted">@extends('products.layout')<br>@section('content')<br><br>    &lt;div class="container" style="margin-right: -87px;"&gt;<br>&lt;div class="row"&gt;<br>    &lt;div class="col-lg-6"&gt;<br>        &lt;div class="pull-left"&gt;<br>            &lt;h2&gt;Add New Product&lt;/h2&gt;<br>        &lt;/div&gt;<br>        &lt;div class="pull-right"&gt;<br>            &lt;a class="btn btn-primary" href="{{ route('products.index') }}"&gt; Back&lt;/a&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>&lt;/div&gt;<br>     &lt;br&gt;&lt;br&gt;<br>@if ($errors-&gt;any())<br>    &lt;div class="alert alert-danger"&gt;<br>        &lt;strong&gt;Whoops!&lt;/strong&gt; There were some problems with your input.&lt;br&gt;&lt;br&gt;<br>        &lt;ul&gt;<br>            @foreach ($errors-&gt;all() as $error)<br>                &lt;li&gt;{{ $error }}&lt;/li&gt;<br>            @endforeach<br>        &lt;/ul&gt;<br>    &lt;/div&gt;<br>@endif<br>     <br>&lt;form action="{{ route('products.store') }}" method="POST" enctype="multipart/form-data"&gt;<br>    @csrf<br>    <br>     &lt;div class="row"&gt;<br>        <br>        &lt;div class="col-md-12"&gt;<br>                  &lt;div class="form-group"&gt;<br>                      &lt;input type="file" name="image" placeholder="Choose image" id="image"&gt;<br>                        @error('image')<br>                        &lt;div class="alert alert-danger mt-1 mb-1"&gt;{{ $message }}&lt;/div&gt;<br>                        @enderror<br>                  &lt;/div&gt;<br>              &lt;/div&gt;<br> <br>              &lt;!-- &lt;div class="col-md-12 mb-2"&gt;<br>                  &lt;img id="amit-image-before-upload" src="https://www.riobeauty.co.uk/images/product_image_not_found.gif"<br>                      alt="preview image" style="max-height: 250px;"&gt;<br>              &lt;/div&gt; --&gt;<br>        &lt;!-- preview code testing  --&gt;<br>        &lt;div class="col-md-12 mb-2"&gt;<br>                  &lt;img id="amit-image-before-upload" src="https://www.riobeauty.co.uk/images/product_image_not_found.gif"<br>                      alt="preview image" style="max-height: 250px;"&gt;<br>              &lt;/div&gt;<br>        &lt;!-- preview code test ending  --&gt;<br>        &lt;div class="col-lg-12 col-sm-6 col-md-6 text-center"&gt;<br>                &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>     <br>&lt;/form&gt;<br>&lt;/div&gt;<br><br>&lt;script src="https://code.jquery.com/jquery-3.5.1.min.js"&gt;&lt;/script&gt;<br> <br>&lt;script type="text/javascript"&gt;<br>      <br>$(document).ready(function (e) {<br> <br>   <br>   $('#image').change(function(){<br>            <br>    let reader = new FileReader();<br> <br>    reader.onload = (e) =&gt; { <br> <br>      $('#amit-image-before-upload').attr('src', e.target.result); <br>    }<br> <br>    reader.readAsDataURL(this.files[0]); <br>   <br>   });<br>   <br>});<br> <br>&lt;/script&gt;<br><br><br>@endsection</pre>



<p class="wp-block-paragraph" id="a68b">Next create files inside the products folder <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">edit.blade.php</pre>



<p class="wp-block-paragraph" id="6543">Copy below code and paste edit.blade.php file</p>



<pre class="wp-block-preformatted">@extends('products.layout')<br>     <br>@section('content')<br>&lt;br&gt;&lt;br&gt;&lt;br&gt;<br>&lt;div class="container" style="margin-right: -87px;"&gt;<br>    &lt;div class="row"&gt;<br>        &lt;div class="col-lg-4 margin-tb"&gt;<br>            &lt;div class="pull-left"&gt;<br>                &lt;h2&gt;Edit Product&lt;/h2&gt;<br>            &lt;/div&gt;<br>            &lt;div class="pull-right"&gt;<br>                &lt;a class="btn btn-primary" href="{{ route('products.index') }}"&gt; Back&lt;/a&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>     <br>    @if ($errors-&gt;any())<br>        &lt;div class="alert alert-danger"&gt;<br>            &lt;strong&gt;Whoops!&lt;/strong&gt; There were some problems with your input.&lt;br&gt;&lt;br&gt;<br>            &lt;ul&gt;<br>                @foreach ($errors-&gt;all() as $error)<br>                    &lt;li&gt;{{ $error }}&lt;/li&gt;<br>                @endforeach<br>            &lt;/ul&gt;<br>        &lt;/div&gt;<br>    @endif<br>    <br>    &lt;form action="{{ route('products.update',$product-&gt;id) }}" method="POST" enctype="multipart/form-data"&gt; <br>        @csrf<br>        @method('PUT')<br>     <br>         &lt;div class="row"&gt;<br>         &lt;div class="col-lg-2 col-sm-2 col-md-2"&gt;<br>                &lt;div class="form-group"&gt;<br>                    &lt;strong&gt;Name:&lt;/strong&gt;<br>                    &lt;input type="text" name="name" value="{{ $product-&gt;name }}" class="form-control" placeholder="Name"&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>            &lt;div class="col-lg-6 col-sm-6 col-md-6"&gt;<br>                &lt;div class="form-group"&gt;<br>                    &lt;strong&gt;Email:&lt;/strong&gt;<br>                    &lt;input type="text" name="name" value="{{ $product-&gt;email }}" class="form-control" placeholder="email"&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>            &lt;br&gt;<br>            &lt;div class="col-lg-7 col-sm-6 col-md-6"&gt;<br>                &lt;div class="form-group"&gt;<br>                    &lt;strong&gt;Detail:&lt;/strong&gt;<br>                    &lt;textarea class="form-control" style="height:150px" name="detail" placeholder="Detail"&gt;{{ $product-&gt;detail }}&lt;/textarea&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>            &lt;div class="col-lg-4 col-sm-3 col-md-3"&gt;<br>                &lt;div class="form-group"&gt;<br>                    &lt;strong&gt;Image:&lt;/strong&gt;<br>                    &lt;input type="file" name="image" class="form-control" placeholder="image"&gt;<br>                    &lt;img src="/image/{{ $product-&gt;image }}" width="300px"&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>            &lt;div class="col-lg-4 col-sm-4 col-md-4 text-center"&gt;<br>              &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>     <br>    &lt;/form&gt;<br>&lt;/div&gt;<br>@endsection</pre>



<p class="wp-block-paragraph" id="dea8">Next create files inside the products folder <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">show.blade.php</pre>



<p class="wp-block-paragraph" id="dcca">Copy below code and paste show.blade.php file <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">@extends('products.layout')<br>   <br>@section('content')<br>    &lt;div class="row"&gt;<br>        &lt;div class="col-lg-12 margin-tb"&gt;<br>            &lt;div class="pull-left"&gt;<br>                &lt;h2&gt; Show Product&lt;/h2&gt;<br>            &lt;/div&gt;<br>            &lt;div class="pull-right"&gt;<br>                &lt;a class="btn btn-primary" href="{{ route('products.index') }}"&gt; Back&lt;/a&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>     <br>    &lt;div class="row"&gt;<br>        &lt;div class="col-xs-12 col-sm-12 col-md-12"&gt;<br>            &lt;div class="form-group"&gt;<br>                &lt;strong&gt;Name:&lt;/strong&gt;<br>                {{ $product-&gt;name }}<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>        &lt;div class="col-xs-12 col-sm-12 col-md-12"&gt;<br>            &lt;div class="form-group"&gt;<br>                &lt;strong&gt;Email:&lt;/strong&gt;<br>                {{ $product-&gt;email }}<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>        &lt;div class="col-xs-12 col-sm-12 col-md-12"&gt;<br>            &lt;div class="form-group"&gt;<br>                &lt;strong&gt;Details:&lt;/strong&gt;<br>                {{ $product-&gt;detail }}<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>        &lt;div class="col-xs-12 col-sm-12 col-md-12"&gt;<br>            &lt;div class="form-group"&gt;<br>                &lt;strong&gt;Image:&lt;/strong&gt;<br>                &lt;img src="/image/{{ $product-&gt;image }}" width="500px"&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>@endsection</pre>



<p class="wp-block-paragraph" id="86e8">Now go to your terminal paste below code</p>



<pre class="wp-block-preformatted">php artisan serve</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1360/1*8DiiorLR68N0GBauCywkeQ.png" alt=""/></figure>



<pre class="wp-block-preformatted"><a href="http://127.0.0.1:8000/products">http://127.0.0.1:8000/products</a></pre>



<p class="wp-block-paragraph" id="00b3">Now its showing like this</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*Y0Nl-E7en4gN6MhzCnIOYg.png" alt=""/></figure>



<p class="wp-block-paragraph" id="7d2b">Now you can see before submit the data image preview image showing fine</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/818/1*UFitLteiCRcfO61cN1uAsQ.png" alt=""/></figure>



<p class="wp-block-paragraph" id="356a">These steps are implement on my own learning project and looks like this</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1353/1*Hixn8Fqcqjc-cbQ1E-iYCg.png" alt=""/></figure>



<p class="wp-block-paragraph" id="19fa">Thanks i hope its helpfull for you…. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /> if you have any questions comment below. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64b.png" alt="🙋" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64b.png" alt="🙋" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/multi-file-upload-with-image-preview-and-checklist-delete-options/">Multi File upload with Image preview and checklist delete options</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/multi-file-upload-with-image-preview-and-checklist-delete-options/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Upload Multiple Image in Laravel</title>
		<link>https://www.scmgalaxy.com/tutorials/how-to-upload-multiple-image-in-laravel/</link>
					<comments>https://www.scmgalaxy.com/tutorials/how-to-upload-multiple-image-in-laravel/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Sun, 13 Jun 2021 07:16:37 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[crud operation in laravel]]></category>
		<category><![CDATA[image upload in laravel]]></category>
		<category><![CDATA[imageupload]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[Php]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6482</guid>

					<description><![CDATA[<p>In this turoial im going to learn how to upload multiple image in laravel and store in database. Image upload [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-upload-multiple-image-in-laravel/">How to Upload Multiple Image in Laravel</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1200/1*55zM3sNP6eYpOu4PJXzxOg.jpeg" alt=""/></figure>



<p class="wp-block-paragraph" id="7e49">In this turoial im going to learn how to upload multiple image in laravel and store in database. Image upload is necessary of every project. In this project i’m going to learn how to upload with validation like images, mimes, max file upload and etc.</p>



<p class="wp-block-paragraph" id="2900">So let’s go to download project and configure with database. so copy below code and paste in your terminal.</p>



<h1 class="wp-block-heading" id="8692">First let’s go to install laravel project</h1>



<pre class="wp-block-preformatted">composer create-project laravel/laravel admin-dashboard "5.8.*"</pre>



<p class="wp-block-paragraph" id="3552">After Installation setup database So go to the&nbsp;<strong>.env&nbsp;</strong>file and add the database credentials.&nbsp;<em>lets go to&nbsp;</em><strong><em>.env folder</em></strong><em>&nbsp;and put database name and connect to database.</em></p>



<pre class="wp-block-preformatted">DB_CONNECTION=mysql<br>DB_HOST=127.0.0.1<br>DB_PORT=3306<br>DB_DATABASE=admin-dashboard<br>DB_USERNAME=root<br>DB_PASSWORD=</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1043/0*PvP3fh30TrDj-IZJ.png" alt=""/></figure>



<h1 class="wp-block-heading" id="be86">Now migrate the table</h1>



<pre class="wp-block-preformatted">php artisan migrate</pre>



<p class="wp-block-paragraph" id="66cb">Lets go&nbsp;to create migration file to store the image name go to your terminal and paste below code.</p>



<pre class="wp-block-preformatted">php artisan make:migration create_forms_table</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1333/1*15taTXDAZKsRRMwlPTfN7w.png" alt=""/></figure>



<p class="wp-block-paragraph" id="ae43">Let’ go to migration table and add file name.</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>use Illuminate\Support\Facades\Schema;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Database\Migrations\Migration;<br><br>class CreateFormsTable extends Migration<br>{<br>    /**<br>     * Run the migrations.<br>     *<br>     * @return void<br>     */<br>    public function up()<br>    {<br>        Schema::create('forms', function (Blueprint $table) {<br>            $table-&gt;bigIncrements('id');<br>            $table-&gt;string('filename');<br>            $table-&gt;timestamps();<br>        });<br>    }<br><br>    /**<br>     * Reverse the migrations.<br>     *<br>     * @return void<br>     */<br>    public function down()<br>    {<br>        Schema::dropIfExists('forms');<br>    }<br>}</pre>



<p class="wp-block-paragraph" id="ef18">The next step will be to migrate this schema and make a table in the database.</p>



<pre class="wp-block-preformatted">php artisan migrate</pre>



<p class="wp-block-paragraph" id="0122">Next go to create the controller and model file for this project copy below code and paste in your command. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">php artisan make:model Form<br><br>php artisan make:controller FormController</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*Iwcs7eGL7HOKMg_Z3vERBA.png" alt=""/></figure>



<p class="wp-block-paragraph" id="7548">lets got to setup the model and controller file for our project.</p>



<h1 class="wp-block-heading" id="d059">Step 2: Define routes in the web.php file.</h1>



<p class="wp-block-paragraph" id="1ae2">copy below code and paste in your route/web.php file <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">&lt;?php<br><br>/*<br>|--------------------------------------------------------------------------<br>| Web Routes<br>|--------------------------------------------------------------------------<br>|<br>| Here is where you can register web routes for your application. These<br>| routes are loaded by the RouteServiceProvider within a group which<br>| contains the "web" middleware group. Now create something great!<br>|<br>*/<br><br>Route::get('/', function () {<br>    return view('welcome');<br>});<br><br>Auth::routes();<br><br>Route::get('/home', 'HomeController@index')-&gt;name('home');<br><br>Route::get('form','FormController@create');<br>Route::post('form','FormController@store');</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1365/1*j4Xgpuf_n-IXMPM4iudkWw.png" alt=""/></figure>



<p class="wp-block-paragraph" id="9dd8">Go to your controller and paste below code in your controller <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App\Http\Controllers;<br><br>use Illuminate\Http\Request;<br>use App\Form;<br><br>class FormController extends Controller<br>{<br>    public function create()<br>    {<br>        return view('create');<br>    }<br><br>    public function store(Request $request)<br>    {<br>        $this-&gt;validate($request, [<br>            'filename' =&gt; 'required',<br>            'filename.*' =&gt; 'image | mimes:jpeg,png,jpg,gif,svg|max:2048'<br>        ]);<br><br>        if($request-&gt;hasfile('filename'))<br>        {<br>            foreach($request-&gt;file('filename') as $image)<br>            {<br>                $name=$image-&gt;getClientOriginalName();<br>                $image-&gt;move(public_path().'/images',$name);<br>                $data[] =$name;<br>            }<br>        }<br><br>        $form= new Form();<br>        $form-&gt;filename=json_encode($data);<br><br>        $form-&gt;save();<br><br>        return back()-&gt;with('success', 'image has been successfully updated');<br>    }<br><br>    <br>}</pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Now, let us make a&nbsp;<strong>create.blade.php&nbsp;</strong>file inside the Resources/<strong>views&nbsp;</strong>folder.</p></blockquote>



<pre class="wp-block-preformatted">@extends('layouts.app')<br>@section('content')<br><br><br>&lt;div class="container"&gt;<br>      @if (count($errors) &gt; 0)<br>      &lt;div class="alert alert-danger"&gt;<br>        &lt;strong&gt;Whoops!&lt;/strong&gt; There were some problems with your input.&lt;br&gt;&lt;br&gt;<br>        &lt;ul&gt;<br>          @foreach ($errors-&gt;all() as $error)<br>              &lt;li&gt;{{ $error }}&lt;/li&gt;<br>          @endforeach<br>        &lt;/ul&gt;<br>      &lt;/div&gt;<br>      @endif<br><br>        @if(session('success'))<br>        &lt;div class="alert alert-success"&gt;<br>          {{ session('success') }}<br>        &lt;/div&gt; <br>        @endif<br><br>    &lt;h3 class="jumbotron"&gt;Laravel Multiple File Upload&lt;/h3&gt;<br>&lt;form method="post" action="{{url('form')}}" enctype="multipart/form-data"&gt;<br>  {{csrf_field()}}<br><br>        &lt;div class="input-group control-group increment" &gt;<br>          &lt;input type="file" name="filename[]" class="form-control"&gt;<br>          &lt;div class="input-group-btn"&gt; <br>            &lt;button class="btn btn-success" type="button"&gt;&lt;i class="glyphicon glyphicon-plus"&gt;&lt;/i&gt;Add&lt;/button&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>        &lt;div class="clone hide"&gt;<br>          &lt;div class="control-group input-group" style="margin-top:10px"&gt;<br>            &lt;input type="file" name="filename[]" class="form-control"&gt;<br>            &lt;div class="input-group-btn"&gt; <br>              &lt;button class="btn btn-danger" type="button"&gt;&lt;i class="glyphicon glyphicon-remove"&gt;&lt;/i&gt; Remove&lt;/button&gt;<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br><br>        &lt;button type="submit" class="btn btn-primary" style="margin-top:10px"&gt;Submit&lt;/button&gt;<br><br>  &lt;/form&gt;        <br>  &lt;/div&gt;<br><br><br>&lt;script type="text/javascript"&gt;<br><br><br>    $(document).ready(function() {<br><br>      $(".btn-success").click(function(){ <br>          var html = $(".clone").html();<br>          $(".increment").after(html);<br>      });<br><br>      $("body").on("click",".btn-danger",function(){ <br>          $(this).parents(".control-group").remove();<br>      });<br><br>    });<br><br>&lt;/script&gt;<br><br>@endsection</pre>



<p class="wp-block-paragraph" id="dded">Now let’s go to your browser and paste below code <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<pre class="wp-block-preformatted">http://127.0.0.1:8000/form</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*uWPMuT9Y15yEyb4yt-Dq_w.png" alt=""/></figure>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1362/1*vpw_IIPQ7R3wf7UUOo_q6g.png" alt=""/></figure>



<p class="wp-block-paragraph" id="2a0e">Now image has been successfully added in database as well. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1364/1*GEtSZQf3-H1pklr0L1abxQ.png" alt=""/></figure>



<p class="wp-block-paragraph" id="4890">Thanks i hope its helpfull for you. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64f.png" alt="🙏" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a href="https://laravelamit.medium.com/?source=post_sidebar--------------------------post_sidebar-----------">Amit Kumar</a></p>



<p class="wp-block-paragraph">Hi I am Amit Experienced Web Developer with a demonstrated history of working in the information technology and services industry.</p>



<ul class="wp-block-list"><li></li></ul>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-upload-multiple-image-in-laravel/">How to Upload Multiple Image in Laravel</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/how-to-upload-multiple-image-in-laravel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Laravel 8 Form Example Tutorial</title>
		<link>https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/</link>
					<comments>https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Mon, 24 May 2021 12:59:43 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[crud operation in laravel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[formstore]]></category>
		<category><![CDATA[laravel]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6371</guid>

					<description><![CDATA[<p>In this tutorial i’m going to describe to create form and store data in database. Please follow some easy steps [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/">Laravel 8 Form Example Tutorial</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph" id="e1f0">In this tutorial i’m going to describe to create form and store data in database. Please follow some easy steps mentioned below.</p>



<h1 class="wp-block-heading" id="0a64">How to Submit Form Data into Database in Laravel 8</h1>



<ul class="wp-block-list"><li>Step 1 — Install&nbsp;<strong>Laravel 8</strong>&nbsp;Application</li><li>Step 2 — Configuring Database using Env File</li><li>Step 3 — Create Model &amp; Migration File For Add Blog Post Form</li><li>Step 4 — Create Routes</li><li>Step 5 — Creating Controller</li><li>Step 6 — Create Blade File For Add Blog Post Form</li><li>Step 7 — Start Development Server</li><li>Step 8 — Run Laravel 8 Form App On Browser</li></ul>



<h1 class="wp-block-heading" id="bc32">Step 1 — Install Laravel 8 Application</h1>



<pre class="wp-block-preformatted">composer create-project laravel/laravel laravelform</pre>



<ul class="wp-block-list"><li>Step 2 — Configuring Database using Env File</li></ul>



<p class="wp-block-paragraph" id="467e">Now create model and migration table</p>



<pre class="wp-block-preformatted">php artisan make:model Post -m</pre>



<p class="wp-block-paragraph" id="349a">Next go to post migration table and paste below code</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>use Illuminate\Database\Migrations\Migration;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Support\Facades\Schema;<br><br>class CreatePostsTable extends Migration<br>{<br>    /**<br>     * Run the migrations.<br>     *<br>     * @return void<br>     */<br>    public function up()<br>    {<br>        Schema::create('posts', function (Blueprint $table) {<br>            $table-&gt;id();<br>            $table-&gt;string('title');<br>            $table-&gt;string('description');<br>            $table-&gt;timestamps();<br>        });<br>    }<br><br>    /**<br>     * Reverse the migrations.<br>     *<br>     * @return void<br>     */<br>    public function down()<br>    {<br>        Schema::dropIfExists('posts');<br>    }<br>}</pre>



<p class="wp-block-paragraph" id="b14f">Next go to Post model and paste below code</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App;<br><br>use Illuminate\Database\Eloquent\Model;<br><br>class Post extends Model<br>{<br>    protected $fillable=[<br>        'title',<br>        'description'<br>    ];<br>}</pre>



<p class="wp-block-paragraph" id="7367">Now migrate the table run below command</p>



<pre class="wp-block-preformatted">php artisan migrate</pre>



<h1 class="wp-block-heading" id="f679">Step 4 — Create Routes</h1>



<pre class="wp-block-preformatted">&lt;?php<br><br>use Illuminate\Support\Facades\Route;<br><br>/*<br>|--------------------------------------------------------------------------<br>| Web Routes<br>|--------------------------------------------------------------------------<br>|<br>| Here is where you can register web routes for your application. These<br>| routes are loaded by the RouteServiceProvider within a group which<br>| contains the "web" middleware group. Now create something great!<br>|<br>*/<br><br>Route::get('/', function () {<br>    return view('welcome');<br>});<br><br>Route::get('add-blog-post-form', [PostController::class, 'index']);<br>Route::post('store-form', [PostController::class, 'store']);</pre>



<h1 class="wp-block-heading" id="871c">Step 5 — Creating Controller</h1>



<pre class="wp-block-preformatted">php artisan make:controller PostController -r</pre>



<p class="wp-block-paragraph" id="fd0a">Go to your Post controller file and paste below code</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App\Http\Controllers;<br><br>use Illuminate\Http\Request;use App\Post;class PostController extends Controller<br>{<br>    /**<br>     * Display a listing of the resource.<br>     *<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function index()<br>    {<br>        return view('add-blog-post-form');<br>    }<br><br>    /**<br>     * Show the form for creating a new resource.<br>     *<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function create()<br>    {<br>        //<br>    }<br><br>    /**<br>     * Store a newly created resource in storage.<br>     *<br>     * @param  \Illuminate\Http\Request  $request<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function store(Request $request)<br>    {<br>        $post = new Post;<br><br>        $post-&gt;title = $request-&gt;title;<br>        $post-&gt;description = $request-&gt;description;<br><br>        $post-&gt;save();<br><br>        return redirect('add-blog-post-form')-&gt;with('status', 'Blog Post Form Data Has Been inserted');<br>    }<br><br>    /**<br>     * Display the specified resource.<br>     *<br>     * @param  int  $id<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function show($id)<br>    {<br>        //<br>    }<br><br>    /**<br>     * Show the form for editing the specified resource.<br>     *<br>     * @param  int  $id<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function edit($id)<br>    {<br>        //<br>    }<br><br>    /**<br>     * Update the specified resource in storage.<br>     *<br>     * @param  \Illuminate\Http\Request  $request<br>     * @param  int  $id<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function update(Request $request, $id)<br>    {<br>        //<br>    }<br><br>    /**<br>     * Remove the specified resource from storage.<br>     *<br>     * @param  int  $id<br>     * @return \Illuminate\Http\Response<br>     */<br>    public function destroy($id)<br>    {<br>        //<br>    }<br>}</pre>



<h1 class="wp-block-heading" id="eb18">Step 6 — Create Blade File For Form</h1>



<pre class="wp-block-preformatted">add-blog-post-form.blade.php</pre>



<p class="wp-block-paragraph" id="24fd">Go to Resources/views/add-blog-post-form.blade.php and create this file</p>



<pre class="wp-block-preformatted">&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;Laravel 8 Form Example Tutorial laravel Amit&lt;/title&gt;<br>    &lt;meta name="csrf-token" content="{{ csrf_token() }}"&gt;<br><br>    &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"&gt;<br><br>&lt;/head&gt;<br>&lt;body&gt;<br><br>&lt;div class="container mt-4"&gt;<br><br>  @if(session('status'))<br>    &lt;div class="alert alert-success"&gt;<br>        {{ session('status') }}<br>    &lt;/div&gt;<br>  @endif<br><br>  &lt;div class="card"&gt;<br>    &lt;div class="card-header text-center font-weight-bold"&gt;<br>      Laravel 8 - Add Blog Post Form Example<br>    &lt;/div&gt;<br>    &lt;div class="card-body"&gt;<br>      &lt;form name="add-blog-post-form" id="add-blog-post-form" method="post" action="{{url('store-form')}}"&gt;<br>       @csrf<br><br>        &lt;div class="form-group"&gt;<br>          &lt;label for="exampleInputEmail1"&gt;Title&lt;/label&gt;<br>          &lt;input type="text" id="title" name="title" class="form-control" required=""&gt;<br>        &lt;/div&gt;<br><br>        &lt;div class="form-group"&gt;<br>          &lt;label for="exampleInputEmail1"&gt;Description&lt;/label&gt;<br>          &lt;textarea name="description" class="form-control" required=""&gt;&lt;/textarea&gt;<br>        &lt;/div&gt;<br><br>        &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;<br>      &lt;/form&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;    <br>&lt;/body&gt;<br>&lt;/html&gt;</pre>



<p class="wp-block-paragraph" id="a30c">Now refresh the Browser</p>



<pre class="wp-block-preformatted">php artisan serve</pre>



<p class="wp-block-paragraph" id="f3de">When you fire the above given url on browser, you will look like in the following image:</p>



<pre class="wp-block-preformatted">http://127.0.0.1:8000/add-blog-post-form</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1359/1*dcLBw6pyf6tdD7kkFG7smA.png" alt=""/></figure>



<p class="wp-block-paragraph" id="4645">Thanks</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/">Laravel 8 Form Example Tutorial</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/laravel-8-form-example-tutorial/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Target class [PostController] does not exist.</title>
		<link>https://www.scmgalaxy.com/tutorials/target-class-postcontroller-does-not-exist/</link>
					<comments>https://www.scmgalaxy.com/tutorials/target-class-postcontroller-does-not-exist/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Fri, 21 May 2021 12:02:07 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[crud]]></category>
		<category><![CDATA[crud operation in laravel]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[Php]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6315</guid>

					<description><![CDATA[<p>Whenever you got this types of error go to your Route/web.php file and checkout your Controller class is mention there [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/target-class-postcontroller-does-not-exist/">Target class [PostController] does not exist.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/2732/1*zYXhZ0W-6FNZD4gN90uQIQ.png" alt=""/></figure>



<p class="wp-block-paragraph" id="9f4a">Whenever you got this types of error go to your Route/web.php file and checkout your Controller class is mention there or not.</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*dknFRNBrkf7i3jNGw5aJPQ.png" alt=""/></figure>



<p class="wp-block-paragraph" id="c977">Next Go to PostController file and copy your controller class</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*shUfc-bV_sUa7VQhtWqBhQ.png" alt=""/></figure>



<p class="wp-block-paragraph" id="8e2f">Now go to Routes/web.php and class this class</p>



<pre class="wp-block-preformatted">use App\Http\Controllers\PostController;</pre>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*T3oto9BjfSeFrEXyRRLPbw.png" alt=""/></figure>



<pre class="wp-block-preformatted">php artisan serve</pre>



<p class="wp-block-paragraph" id="dd66">Now its working properly</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1276/1*N4nSNuQMwFyD8PUAxWB0tw.png" alt=""/></figure>



<p class="wp-block-paragraph" id="57db">Thanks.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/target-class-postcontroller-does-not-exist/">Target class [PostController] does not exist.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/target-class-postcontroller-does-not-exist/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>General error: 1364 Field ‘phone’ doesn’t have a default value</title>
		<link>https://www.scmgalaxy.com/tutorials/general-error-1364-field-phone-doesnt-have-a-default-value/</link>
					<comments>https://www.scmgalaxy.com/tutorials/general-error-1364-field-phone-doesnt-have-a-default-value/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Wed, 12 May 2021 12:26:22 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[crud operation in laravel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[xampp]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6225</guid>

					<description><![CDATA[<p>SQLSTATE[HY000]: General error: 1364 Field ‘phone’ doesn’t have a default value (SQL: insert into `products` (`name`, `email`, `address`, `image`, `updated_at`, [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/general-error-1364-field-phone-doesnt-have-a-default-value/">General error: 1364 Field ‘phone’ doesn’t have a default value</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph" id="868c">SQLSTATE[HY000]: General error: 1364 Field ‘phone’ doesn’t have a default value (SQL: insert into `products` (`name`, `email`, `address`, `image`, `updated_at`, `created_at`) values (amti,&nbsp;<a href="mailto:kuam@gmail.com">kuam@gmail.com</a>, sdafasdf, 642917381.jpg, 2021–05–11 10:58:35, 2021–05–11 10:58:35))</p>



<p class="wp-block-paragraph" id="79c2">When I’m submit form then got General error field doesn’t have default value. let’s go to solve this.</p>



<p class="wp-block-paragraph" id="179f"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 1 step go to your&nbsp;<a href="http://localhost/phpmyadmin/db_structure.php?server=1&amp;db=exam-system">database</a>&nbsp;and put change none&gt;to Null and save.</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/2444/1*Zbsljf54T7i52ltaXTUC5g.png" alt=""/></figure>



<p class="wp-block-paragraph" id="6ef5">Lets go to&nbsp;<a href="http://localhost/phpmyadmin/tbl_structure.php?db=bootstrap-model&amp;table=products&amp;goto=tbl_structure.php&amp;back=tbl_structure.php&amp;field=name&amp;change_column=1">phpmyadmin</a></p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*YsfnX5FEnXN9iu1bpW1Jjw.png" alt=""/></figure>



<p class="wp-block-paragraph" id="6574"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Click on Structure</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*exRlrUyPQlBmv_L_IdBkzg.png" alt=""/></figure>



<p class="wp-block-paragraph" id="aad5">Click on change and change all field to None to Null and save</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*5WuhrjZmdV7gF7r3T5Bnpw.png" alt=""/></figure>



<p class="wp-block-paragraph" id="034b">Set Null and click on save button</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*mZEfhEoH86McY9ejPgMhcA.png" alt=""/></figure>



<p class="wp-block-paragraph" id="a912"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f441.png" alt="👁" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f441.png" alt="👁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Now its error has been solved and your data has been stored successfully.</p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1366/1*GHQjKJWQAhnhWxHcQSbCwQ.png" alt=""/></figure>



<p class="wp-block-paragraph" id="e8d5">Thanks</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/general-error-1364-field-phone-doesnt-have-a-default-value/">General error: 1364 Field ‘phone’ doesn’t have a default value</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/general-error-1364-field-phone-doesnt-have-a-default-value/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CRUD Operation Detailed Explaination with Example.</title>
		<link>https://www.scmgalaxy.com/tutorials/crud-operation-detailed-explaination-with-example/</link>
					<comments>https://www.scmgalaxy.com/tutorials/crud-operation-detailed-explaination-with-example/#respond</comments>
		
		<dc:creator><![CDATA[abhishek k]]></dc:creator>
		<pubDate>Mon, 08 Mar 2021 13:12:48 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[crud detail explaination]]></category>
		<category><![CDATA[crud examples]]></category>
		<category><![CDATA[crud explaination]]></category>
		<category><![CDATA[crud explanation with example]]></category>
		<category><![CDATA[crud operation in laravel]]></category>
		<category><![CDATA[laravel crud operations]]></category>
		<category><![CDATA[laravel crud operations examples]]></category>
		<category><![CDATA[steps to crud operation]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=5446</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-detailed-explaination-with-example/">CRUD Operation Detailed Explaination with Example.</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 the operation.</p>



<p class="wp-block-paragraph">Explanation for the above operations is given in link below <a href="https://www.scmgalaxy.com/tutorials/crud-operation-prerequisites/" data-type="URL" data-id="https://www.scmgalaxy.com/tutorials/crud-operation-prerequisites/">https://www.scmgalaxy.com/tutorials/crud-operation-prerequisites/</a></p>



<p class="wp-block-paragraph"><strong>5. Create Operation</strong></p>



<p class="wp-block-paragraph">Create a folder Under <strong><em>resource</em> </strong>=&gt;<em><strong>view</strong> </em>=&gt; <strong><em>Task</em></strong> =&gt;<strong><em>File_name</em> </strong> (say <strong><em>create.blade.php</em></strong>) and code the Html part in it.  </p>



<figure class="wp-block-image size-large is-resized is-style-default"><img fetchpriority="high" decoding="async" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-21-1024x576.png" alt="" class="wp-image-5457" width="512" height="288" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-21-1024x576.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-21-300x169.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-21-768x432.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-21-1536x864.png 1536w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-21.png 1920w" sizes="(max-width: 512px) 100vw, 512px" /></figure>



<p class="wp-block-paragraph">We will now move to route(<strong><em>web.php</em></strong>) and create a route for the view . We will use <em>Route::get(&#8216;create&#8217;,&#8217;TaskController@index&#8217;)-&gt;name(&#8216;create&#8217;);</em>                                                                    </p>



<p class="wp-block-paragraph"> We will now move to route(<strong><em>web.php</em></strong>) and create a route for the view to display.                                                                                                                                                                                                                                                                               name(&#8216;<strong>task</strong>&#8216;) is given in the URL as <strong>http://127.0.0.1:8000/task</strong>.                                                                                                                         Control flow:- As the URL is hit the control will go the route(<strong><em>web.php</em></strong>), there we will write                                                                                       <em>Route::get(&#8216;<em>create</em>&#8216;,&#8217;TaskController@create&#8217;)->name(&#8216;<em>create</em>&#8216;);</em>                                     Here, there will be a name match from the URL and if there is a match then there will be a function call named <strong>create</strong> and route will redirect to <em><strong>TaskController.php</strong></em> where it will find the function <em>create </em>and operate according to the instructions given in it. }            </p>



<script src="https://gist.github.com/abhi040498/0955ba05864a7c67b51e6d222ba6a7a3.js"></script>



<p class="wp-block-paragraph">The <em><strong>TaskController.php</strong></em> will get to the create function definition                                    Here this function will return a view <strong><em>create</em>.blade.php</strong>, which has html codes, Output displayed on the browser.                               </p>



<figure class="wp-block-image size-large is-resized is-style-default"><img decoding="async" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-22-1024x576.png" alt="" class="wp-image-5458" width="512" height="288" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-22-1024x576.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-22-300x169.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-22-768x432.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-22-1536x864.png 1536w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-22.png 1920w" sizes="(max-width: 512px) 100vw, 512px" /></figure>



<p class="wp-block-paragraph">After the create operation we need to store the data in the database for this we used <strong><em>&lt;form action=&#8221;{{route(&#8216;store&#8217;)}}&#8221; method=&#8221;POST&#8221;></em></strong> which will call store function.  for that, we need to call the store function when the user clicks submit after entering the data on the above page.                                                     The store function be like                          </p>



<script src="https://gist.github.com/abhi040498/c57065a3124ffb12ff36e63334907604.js"></script>



<p class="wp-block-paragraph">In the store function we create object <strong>$var</strong> of <strong>Task </strong>make variables as      <strong>$var-&gt;task</strong>&nbsp;which is assigned&nbsp;<strong>$request-&gt;task;</strong>&nbsp;(gets value from 1<sup>st</sup> field) &amp; <strong>$var-&gt;detail </strong>which is assigned&nbsp;<strong>$request-&gt;detail;</strong>&nbsp;(gets value from 2<sup>nd</sup> field) and <strong><em>$var-&gt;save(); </em></strong>function will save it to the database.</p>



<p class="wp-block-paragraph">Soon after the data is created and stored in the database, we can view it by performing Read operation.</p>



<p class="wp-block-paragraph"><strong>6. Read operation</strong></p>



<p class="wp-block-paragraph">Create a file in <strong><em>resource</em> </strong>=&gt;<em><strong>view</strong> </em>=&gt; <strong><em>Task</em> </strong>(say, <strong><em>task.blade.php</em></strong>).                                                                                                              and code the Html part in it.       </p>



<figure class="wp-block-image size-large is-resized is-style-default"><img decoding="async" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-19-1024x576.png" alt="" class="wp-image-5454" width="512" height="288" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-19-1024x576.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-19-300x169.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-19-768x432.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-19-1536x864.png 1536w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-19.png 1920w" sizes="(max-width: 512px) 100vw, 512px" /></figure>



<figure class="wp-block-image size-large is-resized is-style-default"><img loading="lazy" decoding="async" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-20-1024x576.png" alt="" class="wp-image-5455" width="512" height="288" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-20-1024x576.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-20-300x169.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-20-768x432.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-20-1536x864.png 1536w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-20.png 1920w" sizes="auto, (max-width: 512px) 100vw, 512px" /></figure>



<p class="wp-block-paragraph">                                                                                                                                                                                                                            We will now move to route(<strong><em>web.php</em></strong>) and create a route for the view to display. We will write the name(&#8216;<strong>task</strong>&#8216;) is given in the URL as <strong>http://127.0.0.1:8000/task</strong>.                                                                                                                         Control flow:- As the URL is hit the control will go the route(<strong><em>web.php</em></strong>), there it will write                                                                                       <em>Route::get(&#8216;task&#8217;,&#8217;TaskController@index&#8217;)->name(&#8216;task&#8217;);</em>                                     Here, there will be a name match from the URL and if there is a match then there will be a function call named <strong>index</strong> and route will redirect to <em><strong>TaskController.php</strong></em> where it will find the function <em>index </em>and operate according to the instructions given in it. }                                                                                               </p>



<script src="https://gist.github.com/abhi040498/82d0d6f56f23cd533d386a93ec7b4682.js"></script>



<p class="wp-block-paragraph">Here this function will return a view taskIndex.blade.php, which has HTML codes, which is to display on the browser with all the things compact.   </p>



<figure class="wp-block-image size-large is-resized is-style-default"><img loading="lazy" decoding="async" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-18-1024x576.png" alt="" class="wp-image-5453" width="512" height="288" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-18-1024x576.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-18-300x169.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-18-768x432.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-18-1536x864.png 1536w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-18.png 1920w" sizes="auto, (max-width: 512px) 100vw, 512px" /></figure>



<p class="wp-block-paragraph">  <strong>7. Update operation</strong></p>



<p class="wp-block-paragraph">Create a file in <strong><em>resource</em> </strong>=&gt;<em><strong>view</strong> </em>=&gt; <strong><em>Task</em> </strong>=&gt;<strong><em> File_name</em></strong> (say, <strong><em>edit.blade.php</em></strong>). and code the Html part in it.                                     </p>



<figure class="wp-block-image size-large is-resized is-style-default"><img loading="lazy" decoding="async" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-24-1024x576.png" alt="" class="wp-image-5460" width="512" height="288" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-24-1024x576.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-24-300x169.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-24-768x432.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-24-1536x864.png 1536w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-24.png 1920w" sizes="auto, (max-width: 512px) 100vw, 512px" /></figure>



<p class="wp-block-paragraph"> For update we need to give an edit button which calls the update function when clicked. for this we used                                                                                                                       <em>&lt;a href=&#8221;{{route(&#8216;notes.edit&#8217;,[&#8216;id&#8217; => $note->id])}}&#8221;  type=&#8221;button&#8221; class=&#8221;btn btn-primary&#8221;>Edit&lt;/a></em>                                                      This will redirect to route (<strong><em>web.php</em></strong>) where we will write                                                      <em>Route::get(&#8216;edit&#8217;,&#8217;TaskController@edit&#8217;)->name(&#8216;edit&#8217;);</em>                                                                                                                                                   Here, there will be a name match from the URL and if there is match then there will be a function call named <strong>edit </strong>and route will redirect to <em><strong>TaskController.php</strong></em> where it will find the function <em>edit </em>and operate according to the instructions given in it.                                                                                                                                                                                                                                       This will call edit function                       </p>



<script src="https://gist.github.com/abhi040498/d6990b216eb841d8db35122c9fe11d72.js"></script>



<p class="wp-block-paragraph">This will find the corresponding <strong>id</strong> and return the edit page view with the details prefilled in it.    </p>



<figure class="wp-block-image size-large is-resized is-style-default"><img loading="lazy" decoding="async" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-23-1024x576.png" alt="" class="wp-image-5459" width="512" height="288" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-23-1024x576.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-23-300x169.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-23-768x432.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-23-1536x864.png 1536w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/03/image-23.png 1920w" sizes="auto, (max-width: 512px) 100vw, 512px" /></figure>



<p class="wp-block-paragraph">On click of submitting after changing the details which were prefilled,                         This will redirect to route (web.php) where we will write    Route::post(&#8216;update/{id}&#8217;,&#8217;TaskController@update&#8217;)->name(&#8216;update&#8217;);         Here, there will be a name match from the URL and if there is a match then there will be a function call named <strong>update </strong>and route will redirect to <em><strong>TaskController.php</strong></em> where it will find the function <em>update </em>and operate according to the instructions given in it.                                                                                                The update function will run.                                                                                                                                </p>



<script src="https://gist.github.com/abhi040498/863a37e330a8c5ee7e016a3b8ab466ec.js"></script>



<p class="wp-block-paragraph"> In the Update function we create object <strong>$var1</strong> of <strong>Task </strong> which finds and matches id and make variables as <strong>$var1->task</strong> which is assigned                                             <strong>$request->task;</strong> (gets value from 1<sup>st</sup> field) &amp; <strong>$var1->detail </strong>which is assigned <strong>$request->detail;</strong> (gets value from 2<sup>nd</sup> field) and <strong><em>$var1->save(); </em></strong>function will save it to the database.                                                                               and <em><strong>return redirect()</strong></em>   will redirect the <em>route </em>to <em>task</em>.                                                                       </p>



<p class="wp-block-paragraph"><strong>7. Delete Operation</strong></p>



<p class="wp-block-paragraph">Implementing delete operation is easy and we need to Just provide a delete button in the html view which will help call the <strong>destroy </strong>function.                          </p>



<p class="wp-block-paragraph">On click of <strong>Delete </strong>button                                                                                                                          This will redirect to route (<strong><em>web.php</em></strong>) where we will write    <em>Route::post(&#8216;delete/{id}&#8217;,&#8217;TaskController@delete&#8217;)->name(&#8216;delete&#8217;);</em>                                                                                                                                                                                        Here, there will be a name match from the URL and if there is a match then there will be a function call named <strong>delete </strong>and route will redirect to <em><strong>TaskController.php</strong></em> where it will find the function <em>delete </em>and operate according to the instructions given in it.                                                                                                The update function will run.                                                                                                                                </p>



<script src="https://gist.github.com/abhi040498/a99c5418db1a2ee83030a4781866f52c.js"></script>



<p class="wp-block-paragraph">In the Update function we create object <strong>$var</strong>2 of <strong>Task </strong> which finds and matches id and <strong><em>$var1->delete(); </em></strong>function will delete it from the database.                                                                               and <em><strong>return redirect()</strong></em>   will redirect the <em>route </em>to <em>task</em>.                                                                       </p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/crud-operation-detailed-explaination-with-example/">CRUD Operation Detailed Explaination with Example.</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-detailed-explaination-with-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
