//json encode
return response()->json([
'name' => 'Abigail',
'state' => 'CA',
]);
//now decode
$response = json_decode($response->getContent()) ;
return response()->json([
'name' => 'Abigail',
'state' => 'CA',
]);
controller:
$formdone = FormResponse::where('task_id', '=', $task->id)->get();
blade:
@foreach ($formdone as $formcount)
@if(isset($formcount->task_id) && isset($formcount->form_id) && $task->id == $formcount->task_id && $form->id == $formcount->form_id
|| isset($formcount->task_id) && isset($formcount->form_id) && $task->id == $formcount->task_id && $form->id == $formcount->form_id
)
<tr>
<td scope="row"> {{ count((explode(',', json_encode($formcount->response)))) }}</td>
</tr>
@endif
@endforeach