<?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>vuejs Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/tag/vuejs/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/tag/vuejs/</link>
	<description>Code Solution</description>
	<lastBuildDate>Fri, 21 May 2021 02:48:01 +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>vuejs Archives - Codeplaners</title>
	<link>https://codeplaners.com/tag/vuejs/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Vue JS Get Array And Object Length</title>
		<link>https://codeplaners.com/vue-js-get-array-and-object-length/</link>
					<comments>https://codeplaners.com/vue-js-get-array-and-object-length/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 21 May 2021 02:48:01 +0000</pubDate>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[Vue Js]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[vue js]]></category>
		<category><![CDATA[vuejs]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=808</guid>

					<description><![CDATA[<p>Hello Dev, Today, i we will show you Vue JS Get Array And Object Length. This article will give you simple example of Vue JS Get Array And Object Length. you will learn Vue JS Get Array And Object Length. If you don&#8217;t know how to get array and object length in vue js. i &#8230; <a href="https://codeplaners.com/vue-js-get-array-and-object-length/" class="more-link">Continue reading<span class="screen-reader-text"> "Vue JS Get Array And Object Length"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/vue-js-get-array-and-object-length/">Vue JS Get Array And Object Length</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 Vue JS Get Array And Object Length. This article will give you simple example of Vue JS Get Array And Object Length. you will learn Vue JS Get Array And Object Length. </p>
<p>If you don&#8217;t know how to get array and object length in vue js. i will give simple example for vue js get array and object length. If you have worked on Javascript and Jquery then you know you can get array length by variable. length so same way you can get array length or object length in vue js application.</p>
<p>So let&#8217;s follow few step to create example of Vue JS Get Array And Object Length.</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;Vue JS Get Array Length Or Object Length Example - ItSolutionStuff.com&lt;/title&gt;
    &lt;script src=&quot;https://cdn.jsdelivr.net/npm/vue&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
   
&lt;div id=&quot;app&quot;&gt;
   
  &lt;ul id=&quot;exampleApp&quot;&gt;
    &lt;li v-if=&quot;myArray.length&quot;&gt;Object Length = {{ myArray.length }}&lt;/li&gt;
    &lt;li v-for=&quot;value in myArray&quot;&gt;
      {{ value.category }}
    &lt;/li&gt;
  &lt;/ul&gt;
  
&lt;/div&gt;
  
&lt;script type=&quot;text/javascript&quot;&gt;
  
    var app = new Vue({
      el: '#app',
      data: {
        myArray: &#x5B;
          { category: 'Laravel' },
          { category: 'PHP' },
          { category: 'Codeigniter' }
        ]
      }
    })
  
&lt;/script&gt;
  
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Output:-</strong>
<per>
Object Length = 3<br />
Laravel<br />
PHP<br />
Codeigniter
</per>
<p>The post <a rel="nofollow" href="https://codeplaners.com/vue-js-get-array-and-object-length/">Vue JS Get Array And Object Length</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/vue-js-get-array-and-object-length/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Vuejs Datepicker Example</title>
		<link>https://codeplaners.com/vuejs-datepicker-example/</link>
					<comments>https://codeplaners.com/vuejs-datepicker-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 09 Apr 2021 04:45:27 +0000</pubDate>
				<category><![CDATA[Vue Js]]></category>
		<category><![CDATA[datetimepicker]]></category>
		<category><![CDATA[vuejs]]></category>
		<category><![CDATA[Vuejs datetimepicker]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=543</guid>

					<description><![CDATA[<p>In this article, we will show you Vuejs datetimepicker Example. This article will give you simple example of how to disable dates in Vuejs datetimepicker. you will learn datetimepicker disable dates. Step:- 1 Create Vue App vue create myApp Step:- 2 Install vuejs-datepicker Package npm install vuejs-datepicker --save Step:- 3 Use vuejs-datepicker in App.vue open &#8230; <a href="https://codeplaners.com/vuejs-datepicker-example/" class="more-link">Continue reading<span class="screen-reader-text"> "Vuejs Datepicker Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/vuejs-datepicker-example/">Vuejs Datepicker Example</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 Vuejs datetimepicker Example. This article will give you simple example of how to disable dates in Vuejs datetimepicker. you will learn datetimepicker disable dates.</p>
<h3>Step:- 1 Create Vue App </h3>
<pre class="brush: php; title: ; notranslate">
vue create myApp
</pre>
<h3>Step:- 2 Install vuejs-datepicker Package </h3>
<pre class="brush: php; title: ; notranslate">
npm install vuejs-datepicker --save
</pre>
<h3>Step:- 3 Use vuejs-datepicker in App.vue </h3>
<p>open your app.vue file and use this code<br />
<strong>src/App.vue</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;template&gt;	
  &lt;div id=&quot;app&quot;&gt;
    &lt;img alt=&quot;Vue logo&quot; src=&quot;./assets/logo.png&quot;&gt;
    &lt;datepicker name=&quot;birthdate&quot;&gt;&lt;/datepicker&gt;
  &lt;/div&gt;
&lt;/template&gt;
     
&lt;script&gt;
import Datepicker from 'vuejs-datepicker'
     
export default {
  name: 'app',
  components: {
    Datepicker
  }
}
&lt;/script&gt;
</pre>
<p>Now you can run vue js following command:</p>
<pre class="brush: plain; title: ; notranslate">npm run serve</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/vuejs-datepicker-example/">Vuejs Datepicker Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/vuejs-datepicker-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Build Laravel Vue JS CRUD Example</title>
		<link>https://codeplaners.com/how-to-build-laravel-vue-js-crud-example/</link>
					<comments>https://codeplaners.com/how-to-build-laravel-vue-js-crud-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 04 Mar 2021 09:13:56 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Vue JS CRUD]]></category>
		<category><![CDATA[vuejs]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=444</guid>

					<description><![CDATA[<p>This post was last updated on March 12th, 2021 at 12:04 pmHow to Build Laravel Vue JS CRUD Example, I will show you how to implement vue js crud example with Laravel. how to build a crude API in Laravel, for example Vue.Js Spa Crude in Laravel. In this laravel vue js crud example, you &#8230; <a href="https://codeplaners.com/how-to-build-laravel-vue-js-crud-example/" class="more-link">Continue reading<span class="screen-reader-text"> "How to Build Laravel Vue JS CRUD Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-build-laravel-vue-js-crud-example/">How to Build Laravel Vue JS CRUD Example</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 March 12th, 2021 at 12:04 pm</p><p>How to Build Laravel Vue JS CRUD Example,  I will show you how to implement vue js crud example with Laravel.</p>
<p>how to build a crude API in Laravel, for example Vue.Js Spa Crude in Laravel.</p>
<p>In this laravel vue js crud example, you will learn how to implement the laravel vue js crud (create, read, update and delete) spa with Vue js router and laravel.</p>
<h3>Laravel Vue JS CRUD (SPA) Example</h3>
<ul style="list-style: circle;padding: 0 0 0 16px;font-weight: 700;line-height: 26px;font-size: 16px;">
<li>Download Laravel</li>
<li>Configure Database</li>
<li>Install NPM</li>
<li>Create Migration, Model and Controller</li>
<li>Add Routes In web.php</li>
<li>Add Vue Js Components</li>
<li>Add Vue Js Routes</li>
<li>Add Vue App.js</li>
<li>Run Server</li>
</ul>
<h3>Step 1:- Download And Install Laravel</h3>
<pre class="brush: php; title: ; notranslate">composer create-project --prefer-dist laravel/laravel blog</pre>
<h3>Step 2:- Configure Database</h3>
<pre class="brush: php; title: ; notranslate">
DB_CONNECTION=mysql 
DB_HOST=127.0.0.1 
DB_PORT=3306 
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=laravel@123
</pre>
<h3>Step 3:- Install NPM</h3>
<h4>Run the following command and install npm</h4>
<pre class="brush: php; title: ; notranslate">npm install</pre>
<h4>next step, use the command and install the vue-router and Vue-Axios will be used for calling Laravel API.</h4>
<pre class="brush: php; title: ; notranslate"> npm install vue-router vue-axios --save </pre>
<h4>Now after this we run this command</h4>
<pre class="brush: php; title: ; notranslate"> npm run watch </pre>
<p>npm run watch with this command compiles the assets.</p>
<h3>Step 4:- Create Migration, Model and Controller</h3>
<h3>Create Model</h3>
<pre class="brush: php; title: ; notranslate"> php artisan make:model Post -m </pre>
<h5>Add code in <b>database/migrations/create_posts_table.php</b></h5>
<pre class="brush: php; title: ; notranslate"> 
&lt;?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
			$table-&gt;bigIncrements('id');
			$table-&gt;string('title');
			$table-&gt;text('description');
			$table-&gt;timestamps();
		});
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}
</pre>
<h5>Add Post table values in <b>app/Models/Post.php</b></h5>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    protected $fillable = &#x5B;'title', 'description'];
}
</pre>
<h5>Migrate the database using the command</h5>
<pre class="brush: php; title: ; notranslate">php artisan migrate</pre>
<h3>Create Post Controller</h3>
<pre class="brush: php; title: ; notranslate">php artisan make:controller PostController</pre>
<h5>open PostController and define index, add, edit, delete methods in PostController.php, go to <b>app\Http\Controllers\PostController.php</b></h5>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
use App\Http\Resources\PostCollection;
use App\Post;
//codeplaners 
class PostController extends Controller
{
    // all posts
    public function index()
    {
        $posts = Post::all()-&gt;toArray();
        return array_reverse($posts);
    }
 
    // add post
    public function add(Request $request)
    {
        $post = new Post(&#x5B;
            'title' =&gt; $request-&gt;input('title'),
            'description' =&gt; $request-&gt;input('description')
        ]);
        $post-&gt;save();
 
        return response()-&gt;json('post successfully added');
    }
 
    // edit post
    public function edit($id)
    {
        $post = Post::find($id);
        return response()-&gt;json($post);
    }
 
    // update post
    public function update($id, Request $request)
    {
        $post = Post::find($id);
        $post-&gt;update($request-&gt;all());
 
        return response()-&gt;json('post successfully updated');
    }
 
    // delete post
    public function delete($id)
    {
        $post = Post::find($id);
        $post-&gt;delete();
 
        return response()-&gt;json('post successfully deleted');
    }
}

</pre>
<h3>Step 5:- Add Routes in Web.php</h3>
<h5>Routes/web.php</h5>
<pre class="brush: php; title: ; notranslate">
&lt;?php
 
Route::get('{any}', function () {
    return view('app');
})-&gt;where('any', '.*');
</pre>
<h5>Routes/Api.php</h5>
<pre class="brush: php; title: ; notranslate">
&lt;?php
use Illuminate\Http\Request;
 
 
Route::get('posts', 'PostController@index');
Route::group(&#x5B;'prefix' =&gt; 'post'], function () {
    Route::post('add', 'PostController@add');
    Route::get('edit/{id}', 'PostController@edit');
    Route::post('update/{id}', 'PostController@update');
    Route::delete('delete/{id}', 'PostController@delete');
});
</pre>
<h3>Step 6:- Add Vue Js</h3>
<p>To setup Vue js in Laravel, create one blade view file named <b>app.blade.php</b></p>
<p>update the code into your app.blade.php file as follow.<br />
<strong>resources/views/layout/app.blade.php </strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;!doctype html&gt;
&lt;html lang=&quot;{{ str_replace('_', '-', 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;meta name=&quot;csrf-token&quot; value=&quot;{{ csrf_token() }}&quot;/&gt;

    &lt;title&gt;Build Laravel Vue JS CRUD Example - CodePalners&lt;/title&gt;

    &lt;link href=&quot;{{ mix('css/app.css') }}&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot;/&gt;
    &lt;style&gt;
        .bg-light {
            background-color: #eae9e9 !important;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;app&quot;&gt;&lt;/div&gt;
&lt;script src=&quot;{{ mix('js/app.js') }}&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3>Step 7:- Add Vue Js Components</h3>
<p>Create Components folder this path <strong>resources/js/components</strong><br />
and components folder add file:</p>
<ul style="list-style: circle;padding: 0 0 0 16px;font-weight: 700;line-height: 26px;font-size: 16px;">
<li>App.vue</li>
<li>AllPost.vue</li>
<li>AddPost.vue</li>
<li>EditPost.vue</li>
</ul>
<p>Open <strong>App.vue</strong> file and update the code your file:-</p>
<pre class="brush: php; title: ; notranslate">
&lt;template&gt;
    &lt;div class=&quot;container&quot;&gt;
        &lt;div class=&quot;text-center&quot; style=&quot;margin: 20px 0px 20px 0px;&quot;&gt;
            &lt;span class=&quot;text-secondary&quot;&gt;Build Laravel Vue JS CRUD Example - CodePalners&lt;/span&gt;
        &lt;/div&gt;
 
        &lt;nav class=&quot;navbar navbar-expand-lg navbar-light bg-light&quot;&gt;
            &lt;div class=&quot;collapse navbar-collapse&quot;&gt;
                &lt;div class=&quot;navbar-nav&quot;&gt;
                    &lt;router-link to=&quot;/&quot; class=&quot;nav-item nav-link&quot;&gt;Home&lt;/router-link&gt;
                    &lt;router-link to=&quot;/add&quot; class=&quot;nav-item nav-link&quot;&gt;Add Post&lt;/router-link&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/nav&gt;
        &lt;br/&gt;
        &lt;router-view&gt;&lt;/router-view&gt;
    &lt;/div&gt;
&lt;/template&gt;
 
&lt;script&gt;
    export default {}
&lt;/script&gt;
</pre>
<p>Open <strong>AllPost.vue</strong> file and update the code your file:-</p>
<pre class="brush: php; title: ; notranslate">
&lt;template&gt;
    &lt;div&gt;
        &lt;h3 class=&quot;text-center&quot;&gt;All Posts&lt;/h3&gt;&lt;br/&gt;
 
        &lt;table class=&quot;table table-bordered&quot;&gt;
            &lt;thead&gt;
            &lt;tr&gt;
                &lt;th&gt;ID&lt;/th&gt;
                &lt;th&gt;Title&lt;/th&gt;
                &lt;th&gt;Description&lt;/th&gt;
                &lt;th&gt;Created At&lt;/th&gt;
                &lt;th&gt;Updated At&lt;/th&gt;
                &lt;th&gt;Actions&lt;/th&gt;
            &lt;/tr&gt;
            &lt;/thead&gt;
            &lt;tbody&gt;
            &lt;tr v-for=&quot;post in posts&quot; :key=&quot;post.id&quot;&gt;
                &lt;td&gt;{{ post.id }}&lt;/td&gt;
                &lt;td&gt;{{ post.title }}&lt;/td&gt;
                &lt;td&gt;{{ post.description }}&lt;/td&gt;
                &lt;td&gt;{{ post.created_at }}&lt;/td&gt;
                &lt;td&gt;{{ post.updated_at }}&lt;/td&gt;
                &lt;td&gt;
                    &lt;div class=&quot;btn-group&quot; role=&quot;group&quot;&gt;
                        &lt;router-link :to=&quot;{name: 'edit', params: { id: post.id }}&quot; class=&quot;btn btn-primary&quot;&gt;Edit
                        &lt;/router-link&gt;
                        &lt;button class=&quot;btn btn-danger&quot; @click=&quot;deletePost(post.id)&quot;&gt;Delete&lt;/button&gt;
                    &lt;/div&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
            &lt;/tbody&gt;
        &lt;/table&gt;
    &lt;/div&gt;
&lt;/template&gt;
 
&lt;script&gt;
    export default {
        data() {
            return {
                posts: &#x5B;]
            }
        },
        created() {
            this.axios
                .get('http://127.0.0.1:8000/api/posts')
                .then(response =&gt; {
                    this.posts = response.data;
                });
        },
        methods: {
            deletePost(id) {
                this.axios
                    .delete(`http://127.0.0.1:8000/api/post/delete/${id}`)
                    .then(response =&gt; {
                        let i = this.posts.map(item =&gt; item.id).indexOf(id); // find index of your object
                        this.posts.splice(i, 1)
                    });
            }
        }
    }
&lt;/script&gt;
</pre>
<p>Open <strong>AddPost.vue</strong> file and update the code your file:-</p>
<pre class="brush: php; title: ; notranslate">
&lt;template&gt;
    &lt;div&gt;
        &lt;h3 class=&quot;text-center&quot;&gt;Add Post&lt;/h3&gt;
        &lt;div class=&quot;row&quot;&gt;
            &lt;div class=&quot;col-md-6&quot;&gt;
                &lt;form @submit.prevent=&quot;addPost&quot;&gt;
                    &lt;div class=&quot;form-group&quot;&gt;
                        &lt;label&gt;Title&lt;/label&gt;
                        &lt;input type=&quot;text&quot; class=&quot;form-control&quot; v-model=&quot;post.title&quot;&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;form-group&quot;&gt;
                        &lt;label&gt;Description&lt;/label&gt;
                        &lt;input type=&quot;text&quot; class=&quot;form-control&quot; v-model=&quot;post.description&quot;&gt;
                    &lt;/div&gt;
                    &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Add Post&lt;/button&gt;
                &lt;/form&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/template&gt;
 
&lt;script&gt;
    export default {
        data() {
            return {
                post: {}
            }
        },
        methods: {
            addPost() {
 
                this.axios
                    .post('http://127.0.0.1:8000/api/post/add', this.post)
                    .then(response =&gt; (
                        this.$router.push({name: 'home'})
                        // console.log(response.data)
                    ))
                    .catch(error =&gt; console.log(error))
                    .finally(() =&gt; this.loading = false)
            }
        }
    }
&lt;/script&gt;
</pre>
<p>Open <strong>EditPost.vue</strong> file and update the code your file:-</p>
<pre class="brush: php; title: ; notranslate">
&lt;template&gt;
    &lt;div&gt;
        &lt;h3 class=&quot;text-center&quot;&gt;Edit Post&lt;/h3&gt;
        &lt;div class=&quot;row&quot;&gt;
            &lt;div class=&quot;col-md-6&quot;&gt;
                &lt;form @submit.prevent=&quot;updatePost&quot;&gt;
                    &lt;div class=&quot;form-group&quot;&gt;
                        &lt;label&gt;Title&lt;/label&gt;
                        &lt;input type=&quot;text&quot; class=&quot;form-control&quot; v-model=&quot;post.title&quot;&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;form-group&quot;&gt;
                        &lt;label&gt;Description&lt;/label&gt;
                        &lt;input type=&quot;text&quot; class=&quot;form-control&quot; v-model=&quot;post.description&quot;&gt;
                    &lt;/div&gt;
                    &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Update Post&lt;/button&gt;
                &lt;/form&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/template&gt;
 
&lt;script&gt;
    export default {
        data() {
            return {
                post: {}
            }
        },
        created() {
            this.axios
                .get(`http://127.0.0.1:8000/api/post/edit/${this.$route.params.id}`)
                .then((response) =&gt; {
                    this.post = response.data;
                    // console.log(response.data);
                });
        },
        methods: {
            updatePost() {
                this.axios
                    .post(`http://127.0.0.1:8000/api/post/update/${this.$route.params.id}`, this.post)
                    .then((response) =&gt; {
                        this.$router.push({name: 'home'});
                    });
            }
        }
    }
&lt;/script&gt;
</pre>
<h3>Step 8:- Add Vue Js Routes</h3>
<p>In this folder <strong>resources>js</strong> add <strong>routes.js</strong> file. </p>
<p>Open <strong>routes.js</strong> file and update the code your file:-</p>
<pre class="brush: plain; title: ; notranslate">
import AllPosts from './components/AllPost.vue';
import AddPost from './components/AddPost.vue';
import EditPost from './components/EditPost.vue';
 
export const routes = &#x5B;
    {
        name: 'home',
        path: '/',
        component: AllPosts
    },
    {
        name: 'add',
        path: '/add',
        component: AddPost
    },
    {
        name: 'edit',
        path: '/edit/:id',
        component: EditPost
    }
];
</pre>
<h3>Step 9:- Add Vue App.js</h3>
<p>this final step, please add the following code in the resources/js/app.js file:-</p>
<pre class="brush: php; title: ; notranslate">
require('./bootstrap');
import Vue from 'vue';
window.Vue = require('vue');
 
import App from './components/App.vue';
import VueRouter from 'vue-router';
import VueAxios from 'vue-axios';
import axios from 'axios';
import {routes} from './routes';
 
 
 
 
Vue.use(VueRouter);
Vue.use(VueAxios, axios);
 
const router = new VueRouter({
    mode: 'history',
    routes: routes
});
 
const app = new Vue({
    el: '#app',
    router: router,
    render: h =&gt; h(App),
});
</pre>
<h3>Step 9:- Run Laravel Vue CRUD App</h3>
<pre class="brush: php; title: ; notranslate">npm run watch</pre>
<pre class="brush: php; title: ; notranslate">php artisan serve</pre>
<p>Open the URL in the browser:</p>
<pre class="brush: php; title: ; notranslate">http://127.0.0.1:8000</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-build-laravel-vue-js-crud-example/">How to Build Laravel Vue JS CRUD Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/how-to-build-laravel-vue-js-crud-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
