Guest User

Untitled

a guest
Feb 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. public function index()
  2. {
  3. $products = $this->product->list();
  4. dd($products);
  5. return view('admin.product.index',compact('products'));
  6. }
  7.  
  8. <section class="content">
  9. <product-list :product-data="{{json_encode($products)}}" :page="{{json_encode($products->links())}}"></product-list>
  10. </section>
  11.  
  12. <template>
  13. <div class="box">
  14. ...
  15. <table class="table table-list">
  16. ...
  17. <tr v-for="item in products" :key="item.id">
  18. <td>{{item.name}}</td>
  19. <td>{{item.createdAt}}</td>
  20. <td>{{item.updatedAt}}</td>
  21. </tr>
  22. ...
  23. </table>
  24. <div class="box-footer">
  25. ...
  26. {{this.page}}
  27. ...
  28. </div>
  29. ...
  30. </div>
  31. </template>
  32. <script>
  33. export default {
  34. props: ['productData','page'],
  35. data(){
  36. return {
  37. ...
  38. products: this.productData.data,
  39. }
  40. },
  41. ...
  42. }
  43. </script>
Add Comment
Please, Sign In to add comment