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 : -> 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 App\DataTables;
- use App\Models\CustomField;
- use App\Models\ProductOrder;
- use App\Models\Product;
- use Barryvdh\DomPDF\Facade as PDF;
- use Yajra\DataTables\EloquentDataTable;
- use Yajra\DataTables\Services\DataTable;
- use Illuminate\Support\Facades\Log;
- use DB;
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3pjzy5x
via IFTTT
Aucun commentaire:
Enregistrer un commentaire