Skip to content

Instantly share code, notes, and snippets.

@0test
Created March 13, 2022 09:56
Show Gist options
  • Save 0test/b3f6d934790ba3d28bb67e6f5c3dde3e to your computer and use it in GitHub Desktop.
Save 0test/b3f6d934790ba3d28bb67e6f5c3dde3e to your computer and use it in GitHub Desktop.
@if ($paginator->hasPages())
<div >
<ul class="pagination">
{{-- Previous Page --}}
@if ($paginator->onFirstPage())
<li>
<span class="button small disabled">Предыдущая</span>
</li>
@else
<li>
<a class="button small" href="{{ $paginator->previousPageUrl() }}" rel="prev">Предыдущая</a>
</li>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Dots" --}}
@if (is_string($element))
<li><span>...</span></li>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li><a class="page active" href="{{ $url }}">{{ $page }}</a></li>
@else
<li><a class="page" href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page --}}
@if ($paginator->hasMorePages())
<li>
<a class="button small" href="{{ $paginator->nextPageUrl() }}" rel="next">Следующая</a>
</li>
@else
<li><span class="small button disabled">Следующая</span></li>
@endif
</ul>
</div>
@endif
<h1>Psts</h1>
@if ($posts)
@foreach ($posts as $post)
<div>
<h2>{{$post['pagetitle']}}</h2>
<img src="{{ $post['post_image']}}" width="50" height="100">
<div>{{ $post['post_anytext'] }}</div>
</div>
@endforeach
@endif
{{ $posts->onEachSide(1)->links('pagination-blog') }}
class PostsController extends BaseController{
public function render()
{
$this->data['posts'] = $this->getPosts();
}
public function getPosts()
{
$result = SiteContent::
where('parent',641)
->withTVs(['post_image','post_anytext'])
->active()
->orderBy('pagetitle', 'asc')
->paginate(20);
return $result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment