I would like to ask your help. I want to display data to table and group by ID that looks like this in laravel 5.
Article 1: good article Comments: 1 - i love this article 2 - good one
Article 2: read this Comments: 3 - waiting for more
here's my API to fetch to my table
$.get('/dev/api/getPODetails?id=' + id, function(data){
console.log(data);
$.each(data, function(index, getPODetails){
$('table.table tbody').append('<tr><td>PO#'+getPODetails.id+'</td><br><td>'+getPODetails.itemdesc+'</td><td>'+getPODetails.ordered+'</td></tr>');
})
});
and my controller
public function getPODetails(){
$supplierid = Input::get('id');
$getSupplierDetails = DB::table('purchase_headers')
->where('purchase_headers.partner_id',$supplierid)
->leftJoin('purchase_details', 'purchase_headers.id', '=', 'purchase_details.po_no_id' )
->leftJoin('items', 'purchase_details.item_id', '=', 'items.id' )
->select('items.description as itemdesc', 'purchase_details.qoh as ordered', 'purchase_headers.id as id')
->groupBy('purchase_details.id')
->get();
return Response::json($getSupplierDetails, 200, array(), JSON_PRETTY_PRINT);
}
And I want to save all the details from the table.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1i0PKVD
via IFTTT
Aucun commentaire:
Enregistrer un commentaire