I have a manual query
in my model, and I want to return to view
of blade
the result of this query with pagination. Is there any way?
Model
class Ticket extends Model
{
protected $fillable = [
'id',
'title',
'description',
'created_at',
'priority',
'g',
'u',
't',
'provide_closure',
'situation',
'solution',
'closing_date',
'client_id',
'ticket_type_id',
'ticket_category_id',
'equipment_id',
'user_id'
];
protected $table = 'ticket';
public function getClosed()
{
return $this->where('situation', '=', 4)->orderBy('priority', 'desc')->get();
}
}
Controller
public function getClosed()
{
$ticket = new Ticket();
$data = $ticket->getClosed(); //Preciso paginar isso.
$progress = $this->getProgress();
return view('ticket.index', ['data' => $data, 'progress' => $progress]);
}