title: Creating Show Method using vue js, vue-resource & Laravel
body: <p>So i have made an api using laravel 5.2, and used VueJs to pull data from it. I was able to fetch data for the index() action by fetching all the results. Now my issue becomes little more complicated. I need to make a show() method so that each post from the table would go to it's single post page. </p>
  
  <pre><code>methods: {
          fetchItems: function (page) {
              var data = {page: page};
              this.$http.get('api/v1/pages', data).then(function (response) {
                  //look into the routes file and format your response
                  this.$set('items', response.data.data);
                  this.$set('pagination', response.data.pagination);
              }, function (error) {
  
              });
          },
          changePage: function (page) {
              this.pagination.current_page = page;
              this.fetchItems(page);
          }
      }
  </code></pre>
  
  <p>This is my VueJs Code.</p>
  
  <pre><code> &lt;div class="col-md-12" v-for="post in items" track-by="$index"&gt;
              &lt;a href="@{{ post.slug }}"&gt;&lt;h1&gt;@{{ post.title }}&lt;/h1&gt;&lt;/a&gt;
              &lt;p&gt;@{{ post.body }}&lt;/p&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>This is my Show all posts </p>
  
  <p>My questions: 
  1. Should i create a separate file for show method ?
  2. How can i leverage laravel ioc to get $slug from post model and show single page.</p>