<?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>Codeplaners Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/category/codeplaners/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/category/codeplaners/</link>
	<description>Code Solution</description>
	<lastBuildDate>Mon, 07 Jul 2025 05:24:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>

<image>
	<url>https://codeplaners.com/wp-content/uploads/2020/09/cropped-favicon-social-32x32.png</url>
	<title>Codeplaners Archives - Codeplaners</title>
	<link>https://codeplaners.com/category/codeplaners/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Laravel 12: Step-by-Step Guide to Comment System with Replies</title>
		<link>https://codeplaners.com/laravel-12-step-by-step-guide-to-comment-system-with-replies/</link>
					<comments>https://codeplaners.com/laravel-12-step-by-step-guide-to-comment-system-with-replies/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 07 Jul 2025 05:24:41 +0000</pubDate>
				<category><![CDATA[Codeplaners]]></category>
		<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Laravel 12]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1791</guid>

					<description><![CDATA[<p>Hi Dev, People can chat with you and each other. That makes them feel part of something, and they’re more likely to return. When readers comment, they spend more time on your page. They may even come back to reply. That’s good for your blog’s stickiness. Comments tell you what readers liked, didn’t get, or &#8230; <a href="https://codeplaners.com/laravel-12-step-by-step-guide-to-comment-system-with-replies/" class="more-link">Continue reading<span class="screen-reader-text"> "Laravel 12: Step-by-Step Guide to Comment System with Replies"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-12-step-by-step-guide-to-comment-system-with-replies/">Laravel 12: Step-by-Step Guide to Comment System with Replies</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p> People can chat with you and each other. That makes them feel part of something, and they’re more likely to return. When readers comment, they spend more time on your page. They may even come back to reply. That’s good for your blog’s stickiness. Comments tell you what readers liked, didn’t get, or want more of—great sparks for new posts. Readers’ comments add new words and ideas to your posts. This can help search engines see your page as more valuable.</p>
<p>We’ll begin by adding Laravel UI to set up basic user authentication, including registration and login screens. Next, we’ll build a posts table with title and body fields to allow users to create content. Once users are registered, they&#8217;ll be able to publish posts that other users can view. We’ll enable commenting on posts, and also support replies to those comments for nested discussions. To manage these relationships, we&#8217;ll utilize Laravel’s Eloquent methods—hasMany() for one-to-many and belongsTo() for the inverse connection. Follow along through each step to implement this fully functional, user-driven content system with nested commenting!</p>
<p><strong>Step for Creating Comment System in Laravel 12</strong><br />
<strong>Step 1: </strong>Install Laravel 12<br />
<strong>Step 2:</strong> Create Auth using Scaffold<br />
<strong>Step 3:</strong> Create Posts and Comments Tables<br />
<strong>Step 4:</strong> Create Models<br />
<strong>Step 5:</strong> Create Routes<br />
<strong>Step 6:</strong> Create Controller<br />
<strong>Step 7:</strong> Create and Update Blade Files<br />
Run Laravel App</p>
<h3 class="step_code">Install Laravel 12</h3>
<p>For Installing Laravel application 12 run below command. let&#8217;s start:</p>
<pre class="brush: php; title: ; notranslate">
composer create-project laravel/laravel example-app
</pre>
<h3 class="step_code"> Create Auth using Scaffold</h3>
<p>Now, we will create an auth scaffold command to generate login, register, and dashboard functionalities. So, run the below commands:</p>
<p><strong>Laravel 12 UI Package:</strong></p>
<pre class="brush: php; title: ; notranslate">
composer require laravel/ui 
</pre>
<p><strong>Generate Auth:</strong></p>
<pre class="brush: php; title: ; notranslate">
php artisan ui bootstrap --auth 
</pre>
<pre class="brush: php; title: ; notranslate">
npm install
</pre>
<pre class="brush: php; title: ; notranslate">
npm run build
</pre>
<h3 class="step_code"> Create Posts and Comments Tables</h3>
<p>For Creating Posts and Comments tables run below command.</p>
<pre class="brush: php; title: ; notranslate">
php artisan make:migration create_posts_comments_table
</pre>
<p>now, let&#8217;s update the following migrations table:<br />
<strong>database/migrations/2024_06_19_140622_create_posts_comments_table.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create(&#039;posts&#039;, function (Blueprint $table) {
            $table-&gt;id();
            $table-&gt;string(&#039;title&#039;);
            $table-&gt;text(&#039;body&#039;);
            $table-&gt;timestamps();
        });

        Schema::create(&#039;comments&#039;, function (Blueprint $table) {
            $table-&gt;id();
            $table-&gt;integer(&#039;user_id&#039;)-&gt;unsigned();
            $table-&gt;integer(&#039;post_id&#039;)-&gt;unsigned();
            $table-&gt;integer(&#039;parent_id&#039;)-&gt;unsigned()-&gt;nullable();
            $table-&gt;text(&#039;body&#039;);
            $table-&gt;timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists(&#039;posts&#039;);
        Schema::dropIfExists(&#039;comments&#039;);
    }
};
</pre>
<p>now, run the following command:</p>
<pre class="brush: php; title: ; notranslate">
php artisan migrate
</pre>
<h3 class="step_code">Create Models</h3>
<p>To implement a comment system in Laravel, you&#8217;ll need to create Post and Comment models, update the User model, also we will right relationship and some model function.</p>
<pre class="brush: php; title: ; notranslate">
php artisan make:model Post
</pre>
<p>Now, With hasMany() relationship we will update the model file.</p>
<p><strong>app/Models/Post.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use HasFactory;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = &#x5B;&#039;title&#039;, &#039;body&#039;];
   
    /**
     * The has Many Relationship
     *
     * @var array
     */
    public function comments()
    {
        return $this-&gt;hasMany(Comment::class)-&gt;whereNull(&#039;parent_id&#039;)-&gt;latest();
    }
}
</pre>
<p><strong>app/Models/Comment.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Comment extends Model
{
    use HasFactory;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = &#x5B;&#039;user_id&#039;, &#039;post_id&#039;, &#039;parent_id&#039;, &#039;body&#039;];
   
    /**
     * The belongs to Relationship
     *
     * @var array
     */
    public function user()
    {
        return $this-&gt;belongsTo(User::class);
    }
   
    /**
     * The has Many Relationship
     *
     * @var array
     */
    public function replies()
    {
        return $this-&gt;hasMany(Comment::class, &#039;parent_id&#039;);
    }
}
</pre>
<h3 class="step_code"> Create Routes</h3>
<p>Now, we need to create some routes. So open your &#8220;routes/web.php&#8221; file and add the following route.<br />
<strong>routes/web.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

use Illuminate\Support\Facades\Route;

use App\Http\Controllers\PostController;

Route::get(&#039;/&#039;, function () {
    return view(&#039;welcome&#039;);
});

Auth::routes();

Route::get(&#039;/home&#039;, &#x5B;App\Http\Controllers\HomeController::class, &#039;index&#039;])-&gt;name(&#039;home&#039;);

Route::middleware(&#039;auth&#039;)-&gt;group(function () {
    Route::get(&#039;/posts&#039;, &#x5B;PostController::class, &#039;index&#039;])-&gt;name(&#039;posts.index&#039;);
    Route::post(&#039;/posts&#039;, &#x5B;PostController::class, &#039;store&#039;])-&gt;name(&#039;posts.store&#039;);
    Route::get(&#039;/posts/{id}&#039;, &#x5B;PostController::class, &#039;show&#039;])-&gt;name(&#039;posts.show&#039;);
    Route::post(&#039;/posts/comment/store&#039;, &#x5B;PostController::class, &#039;commentStore&#039;])-&gt;name(&#039;posts.comment.store&#039;);
});
</pre>
<h3 class="step_code">Create Controller</h3>
<p>In this step, We create a new controoler, PostController. So let&#8217;s put the code below.<br />
<strong>app/Http/Controllers/PostController.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
   
namespace App\Http\Controllers;
   
use Illuminate\Http\Request;
use App\Models\Post;
use App\Models\Comment;
   
class PostController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $posts = Post::latest()-&gt;get();
    
        return view(&#039;posts.index&#039;, compact(&#039;posts&#039;));
    }
    
    /**
     * Write code on Method
     *
     * @return response()
     */
    public function store(Request $request)
    {
        $this-&gt;validate($request, &#x5B;
             &#039;title&#039; =&gt; &#039;required&#039;,
             &#039;body&#039; =&gt; &#039;required&#039;
        ]);
   
        $post = Post::create(&#x5B;
            &#039;title&#039; =&gt; $request-&gt;title,
            &#039;body&#039; =&gt; $request-&gt;body
        ]);
   
        return back()-&gt;with(&#039;success&#039;,&#039;Post created successfully.&#039;);
    }
    
    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $post = Post::find($id);
        return view(&#039;posts.show&#039;, compact(&#039;post&#039;));
    }

    /**
     * Write code on Method
     *
     * @return response()
     */
    public function commentStore(Request $request)
    {
        $request-&gt;validate(&#x5B;
            &#039;body&#039;=&gt;&#039;required&#039;,
        ]);
   
        $input = $request-&gt;all();
        $input&#x5B;&#039;user_id&#039;] = auth()-&gt;user()-&gt;id;
    
        Comment::create($input);
   
        return back()-&gt;with(&#039;success&#039;,&#039;Comment added successfully.&#039;);
    }
}
</pre>
<h3 class="step_code"> Create and Update Blade Files</h3>
<p>Now, we will update app.blade.php file and create posts.blade file. so, let&#8217;s do it.</p>
<p><strong>resources/views/layouts/app.blade.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;!doctype html&gt;
&lt;html lang=&quot;{{ str_replace(&#039;_&#039;, &#039;-&#039;, app()-&gt;getLocale()) }}&quot;&gt;
&lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;

    &lt;!-- CSRF Token --&gt;
    &lt;meta name=&quot;csrf-token&quot; content=&quot;{{ csrf_token() }}&quot;&gt;

    &lt;title&gt;{{ config(&#039;app.name&#039;, &#039;Laravel&#039;) }}&lt;/title&gt;

    &lt;!-- Fonts --&gt;
    &lt;link rel=&quot;dns-prefetch&quot; href=&quot;//fonts.bunny.net&quot;&gt;
    &lt;link href=&quot;https://fonts.bunny.net/css?family=Nunito&quot; rel=&quot;stylesheet&quot;&gt;

    &lt;!-- Scripts --&gt;
    @vite(&#x5B;&#039;resources/sass/app.scss&#039;, &#039;resources/js/app.js&#039;])

    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css&quot; /&gt;

    &lt;style type=&quot;text/css&quot;&gt;
        .img-user{
            width: 40px;
            border-radius: 50%;
        }
        .col-md-1{
            padding-right: 0px !important;
        }
        .img-col{
            width: 5.33% !important;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div id=&quot;app&quot;&gt;
        &lt;nav class=&quot;navbar navbar-expand-md navbar-light bg-white shadow-sm&quot;&gt;
            &lt;div class=&quot;container&quot;&gt;
                &lt;a class=&quot;navbar-brand&quot; href=&quot;{{ url(&#039;/&#039;) }}&quot;&gt;
                    Laravel Comment System Example - ItSolutionStuff.com
                &lt;/a&gt;
                &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-bs-toggle=&quot;collapse&quot; data-bs-target=&quot;#navbarSupportedContent&quot; aria-controls=&quot;navbarSupportedContent&quot; aria-expanded=&quot;false&quot; aria-label=&quot;{{ __(&#039;Toggle navigation&#039;) }}&quot;&gt;
                    &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;
                &lt;/button&gt;

                &lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarSupportedContent&quot;&gt;
                    &lt;!-- Left Side Of Navbar --&gt;
                    &lt;ul class=&quot;navbar-nav me-auto&quot;&gt;

                    &lt;/ul&gt;

                    &lt;!-- Right Side Of Navbar --&gt;
                    &lt;ul class=&quot;navbar-nav ms-auto&quot;&gt;
                        &lt;!-- Authentication Links --&gt;
                        @guest
                            @if (Route::has(&#039;login&#039;))
                                &lt;li class=&quot;nav-item&quot;&gt;
                                    &lt;a class=&quot;nav-link&quot; href=&quot;{{ route(&#039;login&#039;) }}&quot;&gt;{{ __(&#039;Login&#039;) }}&lt;/a&gt;
                                &lt;/li&gt;
                            @endif

                            @if (Route::has(&#039;register&#039;))
                                &lt;li class=&quot;nav-item&quot;&gt;
                                    &lt;a class=&quot;nav-link&quot; href=&quot;{{ route(&#039;register&#039;) }}&quot;&gt;{{ __(&#039;Register&#039;) }}&lt;/a&gt;
                                &lt;/li&gt;
                            @endif
                        @else
                            &lt;li class=&quot;nav-item&quot;&gt;
                                &lt;a class=&quot;nav-link&quot; href=&quot;{{ route(&#039;posts.index&#039;) }}&quot;&gt;{{ __(&#039;Posts&#039;) }}&lt;/a&gt;
                            &lt;/li&gt;
                            &lt;li class=&quot;nav-item dropdown&quot;&gt;
                                &lt;a id=&quot;navbarDropdown&quot; class=&quot;nav-link dropdown-toggle&quot; href=&quot;#&quot; role=&quot;button&quot; data-bs-toggle=&quot;dropdown&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot; v-pre&gt;
                                    {{ Auth::user()-&gt;name }}
                                &lt;/a&gt;

                                &lt;div class=&quot;dropdown-menu dropdown-menu-end&quot; aria-labelledby=&quot;navbarDropdown&quot;&gt;
                                    &lt;a class=&quot;dropdown-item&quot; href=&quot;{{ route(&#039;logout&#039;) }}&quot;
                                       onclick=&quot;event.preventDefault();
                                                     document.getElementById(&#039;logout-form&#039;).submit();&quot;&gt;
                                        {{ __(&#039;Logout&#039;) }}
                                    &lt;/a&gt;

                                    &lt;form id=&quot;logout-form&quot; action=&quot;{{ route(&#039;logout&#039;) }}&quot; method=&quot;POST&quot; class=&quot;d-none&quot;&gt;
                                        @csrf
                                    &lt;/form&gt;
                                &lt;/div&gt;
                            &lt;/li&gt;
                        @endguest
                    &lt;/ul&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/nav&gt;

        &lt;main class=&quot;py-4&quot;&gt;
            @yield(&#039;content&#039;)
        &lt;/main&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>resources/views/posts/index.blade.php</strong></p>
<pre class="brush: php; title: ; notranslate">
@extends(&#039;layouts.app&#039;)

@section(&#039;content&#039;)
&lt;div class=&quot;container&quot;&gt;
    &lt;div class=&quot;row justify-content-center&quot;&gt;
        &lt;div class=&quot;col-md-12&quot;&gt;
            &lt;div class=&quot;card&quot;&gt;
                &lt;div class=&quot;card-header&quot;&gt;&lt;i class=&quot;fa fa-list&quot;&gt;&lt;/i&gt; {{ __(&#039;Posts List&#039;) }}&lt;/div&gt;

                &lt;div class=&quot;card-body&quot;&gt;

                    @session(&#039;success&#039;)
                        &lt;div class=&quot;alert alert-success&quot; role=&quot;alert&quot;&gt; 
                            {{ $value }}
                        &lt;/div&gt;
                    @endsession
                    
                    &lt;p&gt;&lt;strong&gt;Create New Post&lt;/strong&gt;&lt;/p&gt;
                    &lt;form method=&quot;post&quot; action=&quot;{{ route(&#039;posts.store&#039;) }}&quot; enctype=&quot;multipart/form-data&quot;&gt;
                        @csrf
                        &lt;div class=&quot;form-group&quot;&gt;
                            &lt;label&gt;Title:&lt;/label&gt;
                            &lt;input type=&quot;text&quot; name=&quot;title&quot; class=&quot;form-control&quot; /&gt;
                            @error(&#039;title&#039;)
                                &lt;div class=&quot;text-danger&quot;&gt;{{ $message }}&lt;/div&gt;
                            @enderror
                        &lt;/div&gt;
                        &lt;div class=&quot;form-group&quot;&gt;
                            &lt;label&gt;Body:&lt;/label&gt;
                            &lt;textarea class=&quot;form-control&quot; name=&quot;body&quot;&gt;&lt;/textarea&gt;
                            @error(&#039;body&#039;)
                                &lt;div class=&quot;text-danger&quot;&gt;{{ $message }}&lt;/div&gt;
                            @enderror
                        &lt;/div&gt;
                        &lt;div class=&quot;form-group mt-2&quot;&gt;
                            &lt;button type=&quot;submit&quot; class=&quot;btn btn-success btn-block&quot;&gt;&lt;i class=&quot;fa fa-save&quot;&gt;&lt;/i&gt; Submit&lt;/button&gt;
                        &lt;/div&gt;
                    &lt;/form&gt;

                    &lt;p class=&quot;mt-4&quot;&gt;&lt;strong&gt;Post List:&lt;/strong&gt;&lt;/p&gt;
                    
                    @foreach($posts as $post)
                        &lt;div class=&quot;card mt-2&quot;&gt;
                          &lt;div class=&quot;card-body&quot;&gt;
                            &lt;h5 class=&quot;card-title&quot;&gt;{{ $post-&gt;title }}&lt;/h5&gt;
                            &lt;p class=&quot;card-text&quot;&gt;{{ $post-&gt;body }}&lt;/p&gt;
                            &lt;div class=&quot;text-end&quot;&gt;
                                &lt;a href=&quot;{{ route(&#039;posts.show&#039;, $post-&gt;id) }}&quot; class=&quot;btn btn-primary&quot;&gt;View&lt;/a&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;
                    @endforeach

                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
@endsection
</pre>
<p><strong>resources/views/posts/show.blade.php</strong></p>
<pre class="brush: php; title: ; notranslate">
@extends(&#039;layouts.app&#039;)

@section(&#039;content&#039;)
&lt;div class=&quot;container&quot;&gt;
    &lt;div class=&quot;row justify-content-center&quot;&gt;
        &lt;div class=&quot;col-md-12&quot;&gt;
            &lt;div class=&quot;card&quot;&gt;
                &lt;div class=&quot;card-header&quot;&gt;&lt;h1&gt;&lt;i class=&quot;fa fa-thumbs-up&quot;&gt;&lt;/i&gt; {{ $post-&gt;title }}&lt;/h1&gt;&lt;/div&gt;

                &lt;div class=&quot;card-body&quot;&gt;

                    @session(&#039;success&#039;)
                        &lt;div class=&quot;alert alert-success&quot; role=&quot;alert&quot;&gt; 
                            {{ $value }}
                        &lt;/div&gt;
                    @endsession

                    {{ $post-&gt;body }}

                    &lt;h4 class=&quot;mt-4&quot;&gt;Comments:&lt;/h4&gt;

                    &lt;form method=&quot;post&quot; action=&quot;{{ route(&#039;posts.comment.store&#039;) }}&quot;&gt;
                        @csrf
                        &lt;div class=&quot;form-group&quot;&gt;
                            &lt;textarea class=&quot;form-control&quot; name=&quot;body&quot; placeholder=&quot;Write Your Comment...&quot;&gt;&lt;/textarea&gt;
                            &lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; value=&quot;{{ $post-&gt;id }}&quot; /&gt;
                        &lt;/div&gt;
                        &lt;div class=&quot;form-group text-end&quot;&gt;
                            &lt;button class=&quot;btn btn-success mt-2&quot;&gt;&lt;i class=&quot;fa fa-comment&quot;&gt;&lt;/i&gt; Add Comment&lt;/button&gt;
                        &lt;/div&gt;
                    &lt;/form&gt;
                    
                    &lt;hr/&gt;
                    @include(&#039;posts.comments&#039;, &#x5B;&#039;comments&#039; =&gt; $post-&gt;comments, &#039;post_id&#039; =&gt; $post-&gt;id])
                    
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
@endsection

</pre>
<p><strong>resources/views/posts/comments.blade.php</strong></p>
<pre class="brush: php; title: ; notranslate">
@foreach($comments as $comment)
    &lt;div class=&quot;display-comment row mt-3&quot; @if($comment-&gt;parent_id != null) style=&quot;margin-left:40px;&quot; @endif&gt;
        &lt;div class=&quot;col-md-1 text-end img-col&quot;&gt;
            &lt;img src=&quot;https://randomuser.me/api/portraits/men/43.jpg&quot; class=&quot;img-user&quot;&gt;
        &lt;/div&gt;
        &lt;div class=&quot;col-md-11&quot;&gt;
            &lt;strong&gt;{{ $comment-&gt;user-&gt;name }}&lt;/strong&gt;
            &lt;br/&gt;&lt;small&gt;&lt;i class=&quot;fa fa-clock&quot;&gt;&lt;/i&gt; {{ $comment-&gt;created_at-&gt;diffForHumans() }}&lt;/small&gt;
            &lt;p&gt;{!! nl2br($comment-&gt;body) !!}&lt;/p&gt;
            &lt;form method=&quot;post&quot; action=&quot;{{ route(&#039;posts.comment.store&#039;) }}&quot;&gt;
                @csrf
                &lt;div class=&quot;row&quot;&gt;
                    &lt;div class=&quot;col-md-11&quot;&gt;
                        &lt;div class=&quot;form-group&quot;&gt;
                            &lt;textarea class=&quot;form-control&quot; name=&quot;body&quot; placeholder=&quot;Write Your Reply...&quot; style=&quot;height: 40px;&quot;&gt;&lt;/textarea&gt;
                            &lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; value=&quot;{{ $post_id }}&quot; /&gt;
                            &lt;input type=&quot;hidden&quot; name=&quot;parent_id&quot; value=&quot;{{ $comment-&gt;id }}&quot; /&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;col-md-1&quot;&gt;
                        &lt;button class=&quot;btn btn-warning&quot;&gt;&lt;i class=&quot;fa fa-reply&quot;&gt;&lt;/i&gt; Reply&lt;/button&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/form&gt;
            @include(&#039;posts.comments&#039;, &#x5B;&#039;comments&#039; =&gt; $comment-&gt;replies])
        &lt;/div&gt;
    &lt;/div&gt;
@endforeach
</pre>
<p><strong>Run Laravel App:</strong></p>
<pre class="brush: php; title: ; notranslate">
php artisan serve
</pre>
<p><strong>I hope it will assist you…</strong></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-12-step-by-step-guide-to-comment-system-with-replies/">Laravel 12: Step-by-Step Guide to Comment System with Replies</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/laravel-12-step-by-step-guide-to-comment-system-with-replies/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Send OTP Using Email and Redis in Laravel 10</title>
		<link>https://codeplaners.com/send-otp-using-email-and-redis-in-laravel-10/</link>
					<comments>https://codeplaners.com/send-otp-using-email-and-redis-in-laravel-10/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 25 Dec 2024 12:07:05 +0000</pubDate>
				<category><![CDATA[Codeplaners]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1670</guid>

					<description><![CDATA[<p>This post was last updated on January 1st, 2025 at 06:37 amHi Dev, Today, we will show you send OTP using Email and Redis in Laravel 10. This article will give you simple example of send OTP using Email and Redis in Laravel 10. Let&#8217;s discuss send OTP using Email and Redis in Laravel 10. &#8230; <a href="https://codeplaners.com/send-otp-using-email-and-redis-in-laravel-10/" class="more-link">Continue reading<span class="screen-reader-text"> "Send OTP Using Email and Redis in Laravel 10"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/send-otp-using-email-and-redis-in-laravel-10/">Send OTP Using Email and Redis in Laravel 10</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="last-modified">This post was last updated on January 1st, 2025 at 06:37 am</p><p>Hi Dev,</p>
<p>Today, we will show you send OTP using Email and Redis in Laravel 10. This article will give you simple example of send OTP using Email and Redis in Laravel 10. Let&#8217;s discuss send OTP using Email and Redis in Laravel 10. In this article, we will implement a send OTP using Email and Redis in Laravel 10. </p>
<p>So let’s follow few step to create example of send OTP using Email and Redis in Laravel 10.</p>
<h3 class="step_code">Step 1: Install Laravel 10</h3>
<pre class="brush: php; title: ; notranslate">
composer create-project laravel/laravel send-otp
</pre>
<h3 class="step_code">Step 2: Configure Mail and Redis</h3>
<p><strong>.env</strong> file with the required configurations for mail and Redis.</p>
<pre class="brush: php; title: ; notranslate">
MAIL_MAILER=smtp
MAIL_HOST=your mail host
MAIL_PORT=your mail port
MAIL_USERNAME=your mail username
MAIL_PASSWORD=your mail password
MAIL_ENCRYPTION=tls
</pre>
<pre class="brush: php; title: ; notranslate">
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=your redis password
REDIS_PORT=6379
</pre>
<p>Replace the placeholders with your actual mail and redis configuration.</p>
<h3 class="step_code">Step 3: Create a Controller</h3>
<pre class="brush: php; title: ; notranslate">
php artisan make:controller OtpController
</pre>
<p><strong>app/Http/Controllers/OtpController.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Redis;
use App\Mail\OtpMail;
use Illuminate\Http\Request;

class OtpController extends Controller
{
    /**
    * write code for.
    *
    * @param \Illuminate\Http\Request 
    * @return \Illuminate\Http\Response
    * @author &lt;&gt;
    */
    public function sendOtp(Request $request)
    {
        $email = $request-&gt;input(‘email’);
        $otp = rand(100000, 999999);

        Redis::setex(“otp:$email”, 300, $otp);

        Mail::to($email)-&gt;send(new OtpMail($otp));
        return response()-&gt;json(&#x5B;‘message’ =&gt; ‘OTP sent successfully’]);
    }
}
</pre>
<p>This controller will generate a random 6-digit OTP, store it in Redis with a 5-minute expiration and later ring the given email address.</p>
<h3 class="step_code">Step 4: Create a Mailable</h3>
<p><strong>OtpMail.php located in the app/Mail directory</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class OtpMail extends Mailable
{
    use Queueable, SerializesModels;

    public $otp;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($otp) {
        $this-&gt;otp = $otp;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this-&gt;view('emails.otp');
    }
}
</pre>
<h3 class="step_code">Step 5: Create an Email View</h3>
<p>resources/views/emails/otp.blade.php</p>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;One-Time Password&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;h1&gt;Your OTP is: {{ $otp }}&lt;/h1&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre>
<h3 class="step_code">Step 6: Update Routes</h3>
<p><strong>web.php</strong></p>
<pre class="brush: php; title: ; notranslate">
use App\Http\Controllers\OtpController;
Route::post(‘/send-otp’, &#x5B;OtpController::class, ‘sendOtp’]);
</pre>
<h3 class="step_code">Step 7: Run</h3>
<pre class="brush: php; title: ; notranslate">
php artisan serve
</pre>
<p><strong>I hope it will assist you…</strong></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/send-otp-using-email-and-redis-in-laravel-10/">Send OTP Using Email and Redis in Laravel 10</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/send-otp-using-email-and-redis-in-laravel-10/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PhonePe Payment Gateway PHP Example</title>
		<link>https://codeplaners.com/phonepe-payment-gateway-php-example/</link>
					<comments>https://codeplaners.com/phonepe-payment-gateway-php-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 22 Feb 2024 09:52:47 +0000</pubDate>
				<category><![CDATA[Codeplaners]]></category>
		<category><![CDATA[PhonePe Payment Gateway]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1707</guid>

					<description><![CDATA[<p>Hi Dev, Today, we will show you PhonePe Payment Gateway PHP Example. This article will give you simple example of PhonePe Payment Gateway PHP Example. Let&#8217;s discuss PhonePe Payment Gateway PHP Example. In this article, we will implement a PhonePe Payment Gateway PHP Example. So let’s follow few step to create example of PhonePe Payment &#8230; <a href="https://codeplaners.com/phonepe-payment-gateway-php-example/" class="more-link">Continue reading<span class="screen-reader-text"> "PhonePe Payment Gateway PHP Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/phonepe-payment-gateway-php-example/">PhonePe Payment Gateway PHP Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, we will show you PhonePe Payment Gateway PHP Example. This article will give you simple example of PhonePe Payment Gateway PHP Example. Let&#8217;s discuss PhonePe Payment Gateway PHP Example. In this article, we will implement a PhonePe Payment Gateway PHP Example.</p>
<p>So let’s follow few step to create example of PhonePe Payment Gateway PHP Example.</p>
<ul>
<li>Create a Business Account with PhonePe
<li>Generate API Keys</li>
<li>Use Below php code</li>
<li>Make API Requests</li>
<li>Handle the Payment Response</li>
<li>Test the Integration</li>
</ul>
<h3 class="step_code">Step 1: Install Payment</h3>
<p><strong>index.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

$jayParsedAry = &#x5B;
    &quot;merchantId&quot; =&gt; 'MERCHANTUAT', // &lt;THIS IS TESTING MERCHANT ID&gt;
    &quot;merchantTransactionId&quot; =&gt; rand(111111,999999),
    &quot;merchantUserId&quot; =&gt; 'MUID' . time(),
    &quot;amount&quot; =&gt; (1 * 100),
    &quot;redirectUrl&quot; =&gt;  '&lt;YOUR_SITE_REDIRECT_URL&gt;',
    &quot;redirectMode&quot; =&gt; &quot;POST&quot; // GET, POST DEFINE REDIRECT RESPONSE METHOD,
    &quot;redirectUrl&quot; =&gt;  '&lt;YOUR_SITE_CALLBACK_URL&gt;',
    &quot;mobileNumber&quot; =&gt; &quot;&lt;YOUT MOBILE NUMBER&gt;&quot;,
    &quot;paymentInstrument&quot; =&gt; &#x5B;
        &quot;type&quot; =&gt; &quot;PAY_PAGE&quot;
    ]
];

$encode = json_encode($jayParsedAry);
$encoded = base64_encode($encode);
$key = '099eb0cd-02cf-4e2a-8aca-3e6c6aff0399'; // KEY
$key_index = 1; // KEY_INDEX
$string = $encoded . &quot;/pg/v1/pay&quot;.$key;
$sha256 = hash(&quot;sha256&quot;, $string);
$final_x_header = $sha256 . '###'.$key_index;

// $url = &quot;https://api.phonepe.com/apis/hermes/pg/v1/pay&quot;; &lt;PRODUCTION URL&gt;

$url = &quot;https://api-preprod.phonepe.com/apis/pg-sandbox/pg/v1/pay&quot;; // &lt;TESTING URL&gt;

$headers = array(
    &quot;Content-Type: application/json&quot;,
    &quot;accept: application/json&quot;,
    &quot;X-VERIFY: &quot; . $final_x_header,
);

$data = json_encode(&#x5B;'request' =&gt; $encoded]);

$curl = curl_init($url);

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

$resp = curl_exec($curl);

curl_close($curl);

$response = json_decode($resp);

header('Location:' . $response-&gt;data-&gt;instrumentResponse-&gt;redirectInfo-&gt;url);
</pre>
<h3 class="step_code">Step 2: Handle Payment Response</h3>
<p><strong>response.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

$key = '099eb0cd-02cf-4e2a-8aca-3e6c6aff0399'; // KEY
$key_index = 1; // KEY_INDEX

$response = $_POST; // FETCH DATA FROM DEFINE METHOD, IN THIS EXAMPLE I AM DEFINING POST WHILE I AM SENDING REQUEST

$final_x_header = hash(&quot;sha256&quot;, &quot;/pg/v1/status/&quot; . $response&#x5B;'merchantId'] . &quot;/&quot; . $response&#x5B;'transactionId'] . $key_index) . &quot;###&quot; . $key;

$url = &quot;https://api-preprod.phonepe.com/apis/pg-sandbox/pg/v1/status/&quot;.$response&#x5B;'merchantId'].&quot;/&quot;.$response&#x5B;'transactionId']; // &lt;TESTING URL&gt;

$headers = array(
    &quot;Content-Type: application/json&quot;,
    &quot;accept: application/json&quot;,
    &quot;X-VERIFY: &quot; . $final_x_header,
    &quot;X-MERCHANT-ID:&quot;. $response&#x5B;'merchantId']
);

$curl = curl_init($url);

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

$resp = curl_exec($curl);

curl_close($curl);

$responsePayment = json_decode($resp, true);
// HANDLE YOUR PHONEPAY RESPONSE
</pre>
<p><strong>I hope it will assist you…</strong></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/phonepe-payment-gateway-php-example/">PhonePe Payment Gateway PHP Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/phonepe-payment-gateway-php-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>digits_between Validation In Laravel 8</title>
		<link>https://codeplaners.com/digits_between-validation-in-laravel-8/</link>
					<comments>https://codeplaners.com/digits_between-validation-in-laravel-8/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 27 Sep 2021 03:49:12 +0000</pubDate>
				<category><![CDATA[Codeplaners]]></category>
		<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Laravel 8]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1313</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you digits_between validation in laravel 8. This article will give you simple example of digits_between validation in laravel 8. you will digits_between validation in laravel 8. So let’s follow few step to create example of digits_between validation in laravel 8. Solution: $request-&#62;validate(&#x5B; 'amount' =&#62; 'required&#124;digits_between:1,2' ]); Add Route: &#8230; <a href="https://codeplaners.com/digits_between-validation-in-laravel-8/" class="more-link">Continue reading<span class="screen-reader-text"> "digits_between Validation In Laravel 8"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/digits_between-validation-in-laravel-8/">digits_between Validation In Laravel 8</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you digits_between validation in laravel 8. This article will give you simple example of digits_between validation in laravel 8. you will digits_between validation in laravel 8. So let’s follow few step to create example of digits_between validation in laravel 8.</p>
<h3 class="step_code">Solution:</h3>
<pre class="brush: php; title: ; notranslate">
$request-&gt;validate(&#x5B;
    'amount' =&gt; 'required|digits_between:1,2'
]);
</pre>
<h3 class="step_code">Add Route:</h3>
<pre class="brush: php; title: ; notranslate">
use App\Http\Controllers\ValidationController;

Route::get('digits-between',&#x5B;ValidationController::class,'digitsBetweenValidation']);
Route::post('store-digits-between',&#x5B;ValidationController::class,'digitsBetweenStore'])-&gt;name('store.digits.between');
</pre>
<h3 class="step_code">Controller:</h3>
<p><strong>app/Http/Controllers/ValidationController.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ValidationController extends Controller
{
    public function digitsBetweenValidation()
    {
        return view('validation.digitsBetweenValidation');   
    }

    public function digitsBetweenStore(Request $request)
    {
        $request-&gt;validate(&#x5B;
            'amount' =&gt; 'required|digits_between:1,2',
        ]);  
    }
}
</pre>
<h3 class="step_code">View:</h3>
<p><strong>resources/views/validation/lteValidation.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;digits_between Validation In Laravel 8 &lt;/title&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css&quot;  /&gt;
    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot; &gt;&lt;/script&gt;
    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.min.js&quot; &gt;&lt;/script&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css&quot;  /&gt;
    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js&quot; &gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div class=&quot;container mt-5&quot;&gt;
        &lt;div class=&quot;row&quot;&gt;
            &lt;div class=&quot;col-md-8 offset-2 mt-5&quot;&gt;
                &lt;div class=&quot;card&quot;&gt;
                    &lt;div class=&quot;card-header bg-info text-white&quot;&gt;
                        &lt;h3&gt;digits_between Validation In Laravel 8 &lt;/h3&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;card-body&quot;&gt;
                        &lt;form action=&quot;{{ route('store.digits.between') }}&quot; method=&quot;post&quot;&gt;
                            @csrf
                            &lt;div class=&quot;form-group&quot;&gt;
                                &lt;label&gt;Amount :&lt;/label&gt;
                                &lt;input class=&quot;form-control&quot; name=&quot;amount&quot; value=&quot;{{ old('amount') }}&quot;&gt;
                                @if($errors-&gt;has('amount'))
                                    &lt;span class=&quot;text-danger&quot;&gt;{{ $errors-&gt;first('amount') }}&lt;/span&gt;
                                @endif
                            &lt;/div&gt;
                            &lt;div class=&quot;form-group&quot;&gt;
                                &lt;button class=&quot;btn btn-success btn-sm&quot;&gt;Save&lt;/button&gt;
                            &lt;/div&gt;
                        &lt;/form&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3 class="step_code">Run:</h3>
<pre class="brush: php; title: ; notranslate">
php artisan serve
</pre>
<p>I hope it will assist you…</p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/digits_between-validation-in-laravel-8/">digits_between Validation In Laravel 8</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/digits_between-validation-in-laravel-8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Add Social Widget In WordPress</title>
		<link>https://codeplaners.com/how-to-add-social-widget-in-wordpress/</link>
					<comments>https://codeplaners.com/how-to-add-social-widget-in-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 30 May 2021 06:32:44 +0000</pubDate>
				<category><![CDATA[Codeplaners]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=911</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you how to add social widget in wordPress. This article will give you simple example of how to add social widget in wordPress. you will learn how to add social widget in wordPress. So let&#8217;s follow few step to create example of how to add social widget in &#8230; <a href="https://codeplaners.com/how-to-add-social-widget-in-wordpress/" class="more-link">Continue reading<span class="screen-reader-text"> "How To Add Social Widget In WordPress"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-add-social-widget-in-wordpress/">How To Add Social Widget In WordPress</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you how to add social widget in wordPress. This article will give you simple example of how to add social widget in wordPress. you will learn how to add social widget in wordPress. So let&#8217;s follow few step to create example of how to add social widget in wordPress.</p>
<p><img decoding="async" style="border: 3px solid #ff5722;" src="https://codeplaners.com/wp-content/uploads/2021/05/Social-Widget.png" alt="Add Social Widget In WordPress" ></p>
<p>Copy the code and add  it to your <strong>functions.php</strong> file:</p>
<pre class="brush: php; title: ; notranslate">
//////// Add Social Widget
 
class social extends WP_Widget {
 function social() {
  $widget_ops = array('description' =&gt; 'Twitter, Facebook,Email' );
       parent::WP_Widget(false, $name = __('Twitter, Facebook,Email', eedan),$widget_ops);   
 }
 function form($instance) {
  // outputs the options form on admin
?&gt;       
&lt;p&gt;
  &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( 'facebook' ); ?&gt;&quot;&gt;Facebook Url:&lt;/label&gt;
  &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id( 'title' ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( 'facebook' ); ?&gt;&quot; value=&quot;&lt;?php echo $instance&#x5B;'facebook']; ?&gt;&quot; style=&quot;width:100%;&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
  &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( 'twitter' ); ?&gt;&quot;&gt;Twitter Url:&lt;/label&gt;
  &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id( 'twitter' ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( 'twitter' ); ?&gt;&quot; value=&quot;&lt;?php echo $instance&#x5B;'twitter']; ?&gt;&quot; style=&quot;width:100%;&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
  &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( 'digg' ); ?&gt;&quot;&gt;Digg Url:&lt;/label&gt;
  &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id( 'digg' ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( 'digg' ); ?&gt;&quot; value=&quot;&lt;?php echo $instance&#x5B;'digg']; ?&gt;&quot; style=&quot;width:100%;&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
  &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( 'rss' ); ?&gt;&quot;&gt;RSS Url:&lt;/label&gt;
  &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id( 'rss' ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( 'rss' ); ?&gt;&quot; value=&quot;&lt;?php echo $instance&#x5B;'rss']; ?&gt;&quot; style=&quot;width:100%;&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
  &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( 'newsletter' ); ?&gt;&quot;&gt;Rss Feed Link&lt;/label&gt;
  &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id( 'newsletter' ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( 'newsletter' ); ?&gt;&quot; value=&quot;&lt;?php echo $instance&#x5B;'newsletter']; ?&gt;&quot; style=&quot;width:100%;&quot; /&gt;
&lt;/p&gt;
&lt;?php 
 } function widget($args, $instance) {
?&gt;
&lt;div class=&quot;side_bar&quot;&gt;
    &lt;div class=&quot;side_bar_icon&quot;&gt;
     &lt;span&gt;Follow us on:&lt;/span&gt;
     &lt;ul&gt;
        &lt;li&gt;&lt;a href=&quot;&lt;?php echo $instance&#x5B;'facebook']; ?&gt;&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo('template_url');?&gt;/img/facebook.png&quot; alt=&quot;&quot; /&gt; &lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&lt;?php echo $instance&#x5B;'digg']; ?&gt;&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo('template_url');?&gt;/img/digg.png&quot; alt=&quot;&quot; /&gt; &lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&lt;?php echo $instance&#x5B;'twitter']; ?&gt;&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo('template_url');?&gt;/img/twitter.png&quot; alt=&quot;&quot; /&gt; &lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&lt;?php echo $instance&#x5B;'rss']; ?&gt;&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo('template_url');?&gt;/img/rss.png&quot; alt=&quot;&quot; /&gt; &lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;window.open('http://feedburner.google.com/fb/a/mailverify?uri=&lt;?php echo $instance&#x5B;'newsletter']; ?&gt;', 'popupwindow', 'scrollbars=yes,width=550,height=520');&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo('template_url');?&gt;/img/massage.png&quot; alt=&quot;&quot; /&gt; &lt;/a&gt;&lt;/li&gt;                
     &lt;/ul&gt;
     &lt;/div&gt;
&lt;/div&gt;
&lt;?php 
 }

}
register_widget('social');
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-add-social-widget-in-wordpress/">How To Add Social Widget In WordPress</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/how-to-add-social-widget-in-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Laravel 8 Install React</title>
		<link>https://codeplaners.com/laravel-8-install-react/</link>
					<comments>https://codeplaners.com/laravel-8-install-react/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 27 May 2021 00:27:31 +0000</pubDate>
				<category><![CDATA[Codeplaners]]></category>
		<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Laravel 8]]></category>
		<category><![CDATA[Laravel 8 React Install]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=860</guid>

					<description><![CDATA[<p>Hello Dev, Today, i we will show you laravel 8 install react. This article will give you simple example of laravel 8 install react. you will learn laravel 8 install react. So let&#8217;s follow few step to create example of laravel 8 install react. Step 1:- Install Ui/Package First install laravel ui package for starting &#8230; <a href="https://codeplaners.com/laravel-8-install-react/" class="more-link">Continue reading<span class="screen-reader-text"> "Laravel 8 Install React"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-8-install-react/">Laravel 8 Install React</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hello Dev,</p>
<p>Today, i we will show you laravel 8 install react. This article will give you simple example of laravel 8 install react. you will learn laravel 8 install react. So let&#8217;s follow few step to create example of laravel 8 install react.</p>
<h3>Step 1:- Install Ui/Package</h3>
<p>First install laravel ui package for starting with laravel 8 with react js. run below command and install laravel ui.</p>
<pre class="brush: php; title: ; notranslate">
composer require laravel/ui
</pre>
<h3>Step 2:- Install react</h3>
<pre class="brush: php; title: ; notranslate">
php artisan ui react
</pre>
<h3>Step 3:- Install React with auth</h3>
<pre class="brush: php; title: ; notranslate">
php artisan ui react --auth
</pre>
<p>Now we have to compile a js assets. So you also need to install npm and run it. so let&#8217;s run the command.</p>
<pre class="brush: php; title: ; notranslate">
npm install


npm run dev
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-8-install-react/">Laravel 8 Install React</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/laravel-8-install-react/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>switches for checkboxes style switchery JS</title>
		<link>https://codeplaners.com/switches-for-checkboxes-style-switchery-js/</link>
					<comments>https://codeplaners.com/switches-for-checkboxes-style-switchery-js/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 14 Apr 2021 08:11:47 +0000</pubDate>
				<category><![CDATA[Bootstrap]]></category>
		<category><![CDATA[Codeplaners]]></category>
		<category><![CDATA[HTML&CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=585</guid>

					<description><![CDATA[<p>In this article, we will show you switches for checkboxes style switchery JS. This article will give you simple example of switches for checkboxes style switchery JS. you will learn switches for checkboxes style switchery JS. Example &#60;!DOCTYPE html&#62; &#60;html&#62; &#60;head&#62; &#60;title&#62;switches for checkboxes style switchery JS - codeplaners.com&#60;/title&#62; &#60;script src=&#34;https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62; &#60;link rel=&#34;stylesheet&#34; href=&#34;https://cdnjs.cloudflare.com/ajax/libs/switchery/0.8.2/switchery.min.css&#34;&#62; &#8230; <a href="https://codeplaners.com/switches-for-checkboxes-style-switchery-js/" class="more-link">Continue reading<span class="screen-reader-text"> "switches for checkboxes style switchery JS"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/switches-for-checkboxes-style-switchery-js/">switches for checkboxes style switchery JS</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this article, we will show you switches for checkboxes style switchery JS. This article will give you simple example of switches for checkboxes style switchery JS. you will learn switches for checkboxes style switchery JS.</p>
<p><strong>Example</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;switches for checkboxes style switchery JS - codeplaners.com&lt;/title&gt;
    &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/switchery/0.8.2/switchery.min.css&quot;&gt;
    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/switchery/0.8.2/switchery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;input type=&quot;checkbox&quot; class=&quot;js-switchery&quot; checked /&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
      var elem = document.querySelector('.js-switchery');
      var init = new Switchery(elem);
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/switches-for-checkboxes-style-switchery-js/">switches for checkboxes style switchery JS</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/switches-for-checkboxes-style-switchery-js/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Youtube Video Download In Bootstrap</title>
		<link>https://codeplaners.com/youtube-video-download-in-bootstrap/</link>
					<comments>https://codeplaners.com/youtube-video-download-in-bootstrap/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 09 Apr 2021 05:27:32 +0000</pubDate>
				<category><![CDATA[Bootstrap]]></category>
		<category><![CDATA[Codeplaners]]></category>
		<category><![CDATA[HTML&CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[YouTube]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[html]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=546</guid>

					<description><![CDATA[<p>In this article, we will show you how to create youtube video download script code useing loader api, I will show example of youtube video download script code, This article will give you simple example of download youtube video. I will download youtube video in any size useing loader api. &#60;!DOCTYPE html&#62; &#60;html&#62; &#60;head&#62; &#60;title&#62;Youtube &#8230; <a href="https://codeplaners.com/youtube-video-download-in-bootstrap/" class="more-link">Continue reading<span class="screen-reader-text"> "Youtube Video Download In Bootstrap"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/youtube-video-download-in-bootstrap/">Youtube Video Download In Bootstrap</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this article, we will show you how to create youtube video download script code useing loader api, I will show example of youtube video download script code, This article will give you simple example of download youtube video.  I will download youtube video in any size useing loader api.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Youtube Video Download - codeplaners.com&lt;/title&gt;
  &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-alpha1/css/bootstrap.min.css&quot;&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-alpha1/js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body class=&quot;bg-dark&quot;&gt;
  &lt;div class=&quot;col-md-6 offset-md-3 mt-5&quot;&gt;
    &lt;div class=&quot;card&quot;&gt;
      &lt;div class=&quot;card-header bg-dark&quot;&gt;
        &lt;h3 style=&quot;color:#fff;&quot;&gt;Youtube Video Download - codeplaners.com&lt;/h3&gt;
      &lt;/div&gt;
      &lt;div class=&quot;card-body&quot;&gt;
        &lt;div class=&quot;row&quot;&gt;
          &lt;div class=&quot;col-md-12&quot;&gt;
            &lt;div class=&quot;form-group&quot;&gt;
              &lt;label class=&quot;text-weight&quot;&gt;&lt;b&gt;Youtube Video Link:&lt;/b&gt;&lt;/label&gt;
              &lt;input type=&quot;txt&quot; name=&quot;link&quot; class=&quot;form-control link&quot; required&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;form class=&quot;form-download&quot;&gt;
          &lt;div class=&quot;row&quot;&gt;
            &lt;div class=&quot;col-md-12&quot;&gt;
              &lt;div class=&quot;form-group&quot;&gt;
                &lt;label class=&quot;text-weight&quot;&gt;&lt;b&gt;Select Video Size:&lt;/b&gt;&lt;/label&gt;
                &lt;select class=&quot;form-control sizes&quot; required&gt;
                  &lt;option selected disabled&gt;Select Video Size&lt;/option&gt;
                  &lt;option value=&quot;mp3&quot;&gt;Mp3&lt;/option&gt;
                  &lt;option value=&quot;mp4a&quot;&gt;144 Mp4&lt;/option&gt;
                  &lt;option value=&quot;360&quot;&gt;360 Mp4&lt;/option&gt;
                  &lt;option value=&quot;480&quot;&gt;480 Mp4&lt;/option&gt;
                  &lt;option value=&quot;720&quot;&gt;720 Mp4&lt;/option&gt;
                  &lt;option value=&quot;1080&quot;&gt;1080 Mp4&lt;/option&gt;
                  &lt;option value=&quot;4k&quot;&gt;4k Mp4&lt;/option&gt;
                  &lt;option value=&quot;8k&quot;&gt;8k Mp4&lt;/option&gt;
                &lt;/select&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;row&quot;&gt;
            &lt;div class=&quot;col-md-12&quot;&gt;
              &lt;div class=&quot;form-group mt-4 download-video&quot;&gt;
                &lt;button class=&quot;btn btn-success btn-block click-btn-down&quot; type=&quot;submit&quot;&gt;Submit&lt;/button&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/form&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/body&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
  $(&quot;.click-btn-down&quot;).click(function(){
      var link = $(&quot;.link&quot;).val();
    var size = $(&quot;.sizes&quot;).children(&quot;option:selected&quot;).val();
    var src =&quot;&quot;+link+&quot;=&quot;+size+&quot;&quot;;
    downloadVideo(link,size);
  });
  function downloadVideo(link,size) {
      $('.download-video').html('&lt;iframe style=&quot;width:100%;height:60px;border:0;overflow:hidden;&quot; scrolling=&quot;no&quot; src=&quot;https://loader.to/api/button/?url='+link+'&amp;f='+size+'&quot;&gt;&lt;/iframe&gt;');
  }
&lt;/script&gt;
&lt;/html&gt;
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/youtube-video-download-in-bootstrap/">Youtube Video Download In Bootstrap</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/youtube-video-download-in-bootstrap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
