jeudi 13 septembre 2018

Laravel raw expression query localization (v 5.6)

I am using laravel (5.6) raw expression query and doing morris donut chart with this. My web site has localization support. Every field working fine which are comes from language PHP files. But these data i mean coming from mysql for morris chart is native language. I couldn't make them multilanguage supported.

class DashboardController extends Controller {
public function Index() {

    $emlakCounts = DB::table('emlaks')
        ->join('property_types', 'property_types.id', '=', 'emlaks.property_type_id')
        ->select(DB::raw('property_types.title as label'), DB::raw('count(*) as value'))
        ->groupBy('label')
        ->get();

    $otomobilsCounts = DB::table('otomobils')
        ->join('vehicle_types', 'vehicle_types.id', '=', 'otomobils.vehicle_type_id')
        ->select(DB::raw('vehicle_types.title as label'), DB::raw('count(*) as value'))
        ->groupBy('label')
        ->get();

    return view('admin.dashboard', [
        'total_emlaks' => DB::table('emlaks')->count(),
        'total_otomobils' => DB::table('otomobils')->count(),
        'total_members' => DB::table('users')->count(),
        'total_messages' => DB::table('messages')->count(),
        'emlakCounts' => $emlakCounts,
        'otomobilsCounts' => $otomobilsCounts
    ]);
}
}

and this is output

[{"label":"House","value":1},{"label":"Land","value":1}]

(property_types is coming from mysql). I must make labels multilanguage supported but i don't know what should i do.



these is not working.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2p4rJmj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire