I'm building a ticket system. A ticket can have multiple comments. But how can I paginate this right?
This is my controller:
public function showTicket($slug)
{
$ticket = Ticket::whereSlug($slug);
if(Auth::user()->id == $ticket->user_id)
{
return view('users.ticket')->with('ticket',$ticket);
}
}
This is my view right now:
@foreach($ticket->reactions as $reaction)
<div class="panel panel-default">
<div class="panel-heading"><strong>{!! ucfirst($reaction->user->name) !!} {!! $reaction->user->lastname !!}<span class="pull-right">{!! $reaction->created_at !!}</span></strong></div>
<div class="panel-body">
{!! $reaction->content !!}
</div>
</div>
@endforeach
When I say in my controller:
$ticket = Ticket::whereSlug($slug)->paginate(15);
and in my view:
{!! $ticket->reactions->render() !!}
It's not working.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1KyBYiY
via IFTTT
Aucun commentaire:
Enregistrer un commentaire