PHP | LARAVEL | EloquentDataTable datatable query always returning 10 rows to the max

I’m trying to show the list of productOrders based on an order ID within one of my view. Here’s the code snip from my app/Datatables/ProductOrderDatatables.php which i use to pull the list from my database table called “product_order” :

public function dataTable($query)
{
$dataTable = new EloquentDataTable($query);
$columns = array_column($this->getColumns(), 'data');
$dataTable = $dataTable
->editColumn('price', function ($productOrder) {
return getPriceColumn($productOrder);
})
->rawColumns(array_merge($columns));

return $dataTable;
}

Here’s my query function within the ProductOrderDatatables.php :

public function query(ProductOrder $model)
{

return $model->newQuery()->with("product")
->where('product_orders.order_id', $this->id)
->select('product_orders.*')->orderBy('product_orders.id', 'desc');
}

Problem :

-> Consider, I try to pull an order with order_id = 314 -> Here’s how the entries look like within the database : enter image description here -> I get ALWAYS 10 results to the MAXIMUM. As you could see there are 11 entries , but i always get capped at 10. I don’t understand where i should be looking for limit for new EloquentDataTable($query) if at all there’s one.

Does somebody have an idea about what i should be looking ?? Running a raw SQL query within the datatabase SQL section returns all 11 as expected. Any hints/suggestions/solutions please ??

Packages list

  • namespace AppDataTables;
  • use AppModelsCustomField;
  • use AppModelsProductOrder;
  • use AppModelsProduct;
  • use BarryvdhDomPDFFacade as PDF;
  • use YajraDataTablesEloquentDataTable;
  • use YajraDataTablesServicesDataTable;
  • use IlluminateSupportFacadesLog;
  • use DB;

from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/3pjzy5x
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.