samedi 25 juin 2016

Count in laravel by data

Here I want to add the data I have based id_data kos, so whenever I add data will auto count by id_data_kos.

here my controller :

$limit = 10;
        $result = DB::table('residents')
        ->join("data_kos","data_kos.id","=","residents.id_data_kos")
        ->select("residents.*","data_kos.title as data_title")
        ->groupBy('id_data_kos')
        ->orderBy('residents.id', 'asc');

$data['posts'] = $result->paginate($limit);

and this my view :

@foreach($posts as $row)
<td></td>
<td>here i want to count</td>
@endforeach

this my table :

this



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28ThKug
via IFTTT

Aucun commentaire:

Enregistrer un commentaire