pagination actus

This commit is contained in:
Olivier Legat 2021-02-23 15:26:30 +01:00
parent 62327ba2f1
commit e71da75c96
8 changed files with 67 additions and 126080 deletions

View file

@ -12,7 +12,9 @@ class NewsController extends Controller
$articles = Articles::where([
['status', 1],
['category_id', 1]
])->orderBy('created_at', 'ASC')->get();
])->orderBy('created_at', 'ASC')->paginate(4);
//$articles = $articles->paginate();
return view('front.news.index', compact('articles'));
}

10090
public/css/app.css vendored

File diff suppressed because one or more lines are too long

2747
public/css/style.css vendored

File diff suppressed because one or more lines are too long

56120
public/js/app.js vendored

File diff suppressed because one or more lines are too long

57107
public/js/main.js vendored

File diff suppressed because one or more lines are too long

View file

@ -42,7 +42,7 @@
-webkit-line-clamp: 4;
p{
}
}
& div:last-child{text-align: right;}
@ -73,7 +73,12 @@
width: 100%;
justify-content: center;
a{
span{
background-color: $second_btn_color;
color: black;
}
a,span{
font-size: 2rem;
line-height: 2rem;
transition: background-color .5s;
@ -86,7 +91,7 @@
color: black;
}
}
}
}
}
@media only screen and (min-width:420px) {
@ -167,7 +172,7 @@
left: calc(100% + 10px);
}
.next a::before{
content: "Résultats précédents ";
content: "Résultats suivants ";
right: calc(100% + 10px);
}
.prev a, .next a{
@ -176,7 +181,7 @@
}
.pagination{
a{
a,span{
font-size: 1rem;
line-height: 1rem;
padding: 0.2rem .5rem;
@ -212,7 +217,7 @@
// ********* *
// ***** *
// ** *
// ** *
// ** *
// ********** *
// * *
// ********* *
@ -224,4 +229,4 @@
// ************
@media only screen and (min-width: 1920px) {
}
}

View file

@ -34,14 +34,14 @@
<div><a href="{{ route('news.show', ['slug' => $article->slug]) }}" class="second-btn">Lire l'article</a></div>
</div>
@endif
@if (($loop->iteration-1) % 2)
</div>
<div class="actus--col flex">
@elseif (($loop->iteration-1) % 4)
@if (!($loop->iteration % 4))
</div>
</div>
<div class="actus--row flex">
<div class="actus--col flex">
@elseif (!($loop->iteration % 2))
</div>
<div class="actus--col flex">
@elseif($loop->last)
</div>
</div>
@ -50,19 +50,7 @@
</section>
<!-- <section class="actus--footer flex">
<div class="prev">
<a href="#"><</span></a>
</div>
<div class="pagination flex">
<a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
</div>
<div class="next">
<a href="#">></a>
</div>
</section> -->
{{ $articles->links('front.news.pagination') }}
</div>
</div>

View file

@ -0,0 +1,38 @@
@if ($paginator->hasPages())
<section class="actus--footer flex">
{{-- Previous Page Link --}}
@if (!$paginator->onFirstPage())
<div class="prev">
<a href="{{ $paginator->previousPageUrl() }}"><</span></a>
</div>
@endif
{{-- Pagination Elements --}}
<div class="pagination flex">
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<span>{{ $element }}</span>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<span>{{ $page }}</span>
@else
<a href="{{ $url }}">{{ $page }}</a>
@endif
@endforeach
@endif
@endforeach
</div>
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<div class="next">
<a href="{{ $paginator->nextPageUrl() }}">></a>
</div>
@endif
</section>
@endif