我正在使用laravel(5.6)原始表达式查询,并以此做morris甜甜圈图。我的网站具有本地化支持。每个工作正常的字段均来自语言PHP文件。但是这些数据我是说来自MySQL的morris图表是本地语言。我无法使它们支持多语言。
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
]);
}
}
这是输出
[{"label":"House","value":1},{"label":"Land","value":1}]
(property_types来自mysql)。我必须使标签支持多语言,但我不知道该怎么办。
{{ __('langfile.' . $property_types)}}
这不起作用。