I need to add pagination to my results page. I need to show on my page max 6 posts and after add pagination. How can I add it to my function? I'm using Laravel version 5.2.
I'm not sure if I can use render()
.
Here is my controller :
$user = CareerSolution::where ( 'subject', 'LIKE', '%' . $q . '%' )
->where('career_solutions.topic_category_id', '=', $c)
->join('role_users' , 'role_users.user_id', '=', 'career_solutions.user_id')
->join('roles' , 'roles.id', '=', 'role_users.role_id')
->join('users', 'users.id', '=', 'career_solutions.user_id')
->join('categories', 'categories.id', '=', 'career_solutions.topic_category_id')
->orWhere ( 'career_solutions.user_id', 'LIKE', '%' . $q . '%' )
->orWhere ( 'career_solutions.id', '=', 'events.subject')
->orWhere('career_solutions.topic_category_id' ,'=', $category->id)
->orWhere ( 'career_solutions.user_id', '=', 'users.username')
->select('career_solutions.id as id','subject','users.id as user_id','username', 'profile_picture', 'role_id', 'optional', 'topic_category_id','categories.category')
->get ();
Here is my view:
<?php $count_event = 1; ?>
@foreach($details as $user)
@if($count_event == 1)
<div class="news-v2-desc" style="background-color: #f7f8fa">
<div class="row">
<div class="col-md-2">
<?php $img = "thumbnail/".$user->profile_picture; ?>
@if(@getimagesize($img))
<img style="position: relative;top: 9px;" class="img-circle noticeboard-profile-picture-neo col-md-2" src="" alt="">
@endif
</div>
<div class="col-md-10 noticeboard-subjecttitle">
<h4 class="noticeboard-title" style="text-align: justify;position: relative;right: -15px;">
<a href="/_" class="noticeboard-subject"> </a>
</h4>
<ul style="position: relative;right: -15px" class="list-unstyled list-inline blog-info noticeboard-ul-link">
<li>
@if($user->role_id == 1)
<i class="icon-user"></i>
<a href="/"></a>
@else
<i class="icon-hotel-restaurant-172 u-line-icon-pro fa- fa-lg"></i>
<a href="/"></a>
@endif
</li>
<li>
<i style="font-size: 11px" class="icon-"></i>
<a href="/"></a>
</li>
</ul>
</div>
</div>
<p><a style="border-radius: 0rem !important;border: 0.1rem solid #18ba9b" class="btn-z btn-xs g-mr-10 g-mb-15" href="/_">Read more <i class="fa fa-angle-double-right margin-left-5"></i></a></p>
</div>
</div>
@endif
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire