$posts = Post::query() ->whereNotNull('released_at') ->orderByDesc('released_at') ->paginate(12) ->items(); // only get the data
By accessing the pagination data like above you will be able to loop through the arrays in your views.
@foreach($posts as $post) <div> <h1>{{ $post->title }}</h1> <p>{{ $post->subtitle }}</p> </div> @endforeach
Leave a reply