[Part 7] Laravel Vue Search || laravel 6 blog with vuejs - LaraSix

Поделиться
HTML-код
  • Опубликовано: 4 ноя 2024

Комментарии • 13

  • @shekharror7917
    @shekharror7917 5 лет назад

    Ppease complete the series of laravel vuejs

  • @medoune89
    @medoune89 5 лет назад

    Thanks you man !!!

  • @enelvillafranca4246
    @enelvillafranca4246 5 лет назад

    the filter is problematic with pagination

    • @EasyCodeSardar
      @EasyCodeSardar  5 лет назад

      filter means search right ? you have return data as paginate instead of all data

    • @enelvillafranca4246
      @enelvillafranca4246 5 лет назад

      @@EasyCodeSardar yes, I have return data as paginate instead of all data but same error.
      in console: *posts?page=undefined*

    • @EasyCodeSardar
      @EasyCodeSardar  5 лет назад

      i think you forgot pass "page" in methods like allposts(page)

    • @enelvillafranca4246
      @enelvillafranca4246 5 лет назад

      @@EasyCodeSardar in component async getPosts(page) {
      await axios.get('api/posts?page=' + page, {params: {keywords: this.keywords}})
      .then(res => {
      this.posts = res;
      console.log(res.data);
      });

    • @enelvillafranca4246
      @enelvillafranca4246 5 лет назад

      @@EasyCodeSardar in controller
      if (!empty($request->keywords)) {
      return Post::with('category', 'user', 'comments')
      ->where('title', 'like', '%'. $request->keywords . '%')
      ->paginate(2);
      }
      return Post::with('category', 'user', 'comments')->paginate(2);