Creating Show Method using vue js, vue-resource & Laravel -


so have made api using laravel 5.2, , used vuejs pull data it. able fetch data index() action fetching results. issue becomes little more complicated. need make show() method each post table go it's single post page.

methods: {         fetchitems: function (page) {             var data = {page: page};             this.$http.get('api/v1/pages', data).then(function (response) {                 //look routes file , format 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);         }     } 

this vuejs code.

 <div class="col-md-12" v-for="post in items" track-by="$index">             <a href="@{{ post.slug }}"><h1>@{{ post.title }}</h1></a>             <p>@{{ post.body }}</p>  </div> 

this show posts

my questions: 1. should create separate file show method ? 2. how can leverage laravel ioc $slug post model , show single page.

you don't have create new page, however, unless use vueify, write single file components, may want to. easier.

the same way created list view, ajax call , index api, can create view, ajax call , api, show our posts (using post ids). api response should send data need display, including slug.

based on github repository, create route api, id post id:

route::resource('show/{id}', 'pagescontroller@show');