mercredi 11 mai 2016

Show data from controller to view laravel

in there i want to show data from my controller to my view but i geting error. so now i want to ask how ? let me show my code.

this my controller :

public function getBulan($nama)
    {

        $data['users'] = DB::table('lembur_karyawan')
                ->select('nama', DB::raw('SEC_TO_TIME( SUM( TIME_TO_SEC( total ) ) ) as   total_lembur'))
                ->groupBy('nama')
                ->havingRaw('SUM(total)')
                ->get();

        return view('bulan_user',$data);
    }

and this is my view :

<?php echo $users->{'total_lembur'} ?>

what i want other table if i use first();

have someone know how ? i have no idea how to do it .



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire