I'm doing a query with laravel, and when I paginate, I get an error that says - The paging method does not exist (Method paginate does not exist.)
On the one hand in the controller, I call the query and page as follows:
$img_ventass = Img_venta::busqueda($request->get('raza_id'), $request->get('sexo'), $request->get('fecha_nacimiento'))->paginate(4);
and on the other hand, I make the query in the model like this:
public function scopeBusqueda($query, $raza_id, $sexo, $fecha_nacimiento){
return $query->leftJoin('ventas', function ($leftJoin) use ($raza_id, $sexo) {
$leftJoin->on('img_ventas.venta_id', '=', 'ventas.id')
->where('ventas.raza_id', '=', $raza_id)
->where('ventas.sexo', '=', $sexo);
})->get();
}