Created
March 13, 2022 09:56
-
-
Save 0test/b3f6d934790ba3d28bb67e6f5c3dde3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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') }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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