3
I have a query
manual on my model, and I want to return to view
of blade
the result of this paging query. 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]);
}
Ever tried to change the
get()
forpaginate()
in the methodgetClosed()
of your model?– Amanda Lima
@Amandalima worked . Thank you very much, can formulate the answer so that I accept it?
– Felipe Paetzold