How to get value json in laravel

JSON : {"faktor":["sds"],"presentase":["23"]}

Laravel Controller : public static function factor_task($id_project, $urutan) {

   return (DB::table('project_faktor')  ->select('faktor_presentase')
->where('id_project', '=', $id_project)
->where('urutan', '=', $urutan)
->get());
}

Blade View:

$id_project = $projects->id_project;
$array_delay_factors = (json_decode(App\Http\Controllers\ProjectController::factor_task('51', '1'),true));
$array_delay_factors_count = $array_delay_factors[0]['faktor_presentase'];

echo ($array_delay_factors_count->faktor);

But, it shows error like this Trying to get property 'faktor' of non-object (0) enter image description here



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

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time