mohamedhamidi
1 week ago
255
14
Laravel

Split a page into multiple pages using pagination

Posted 1 week ago by mohamedhamidi

I am making a blog , in the blog.show.blade view sometimes the body is too long and want to divide it into parts and add 'previous' , 'next' buttons , but the problem is that the body is stored all in one column in database so how can i paginate it ?

show.blade.php (the article show view) :

    @if($post->image_url)
    <div class="post-image">
      <img class="mb-5" src="{{ $post->image_url }}" alt="{{ $post->slug }}">
    </div>
    @endif

    <div class="post-title">
      <h1 class="mb-4" >{{ $post->title }}</h1>
    </div>


  <div class="post-body mb-5">
    {!! $post->body_html !!}
  </div>
  </div>
</div>

Please sign in or create an account to participate in this conversation.