I am having a controller that returns a JSON value from the database,
My Controller:
<?php
namespace App\Http\Controllers;
use Auth;
use DB;
use App\EmployeeDetail;
class MyController extends Controller
{
public function index()
{
$employeeDetail = new EmployeeDetail();
if (Auth::check())
{
$id = Auth::user()->id;
$employeeDetail = DB::table('employee_details')->where('user_id', $id)->first();
dump($employeeDetail);
}
return view('myView', compact('employeeDetail'));
}
}
JSON value of $employeeDetail:
{
"id": 1
"emp_id": "1617"
"content": "{"empId": "1617", "field1": "1111", "field2" : "2222"}",
"created_at": "2018-05-12 18:09:52"
"updated_at": "2018-05-12 18:39:30"
}
I need to know how to read the value field1 and field2 in the above JSON in my blade file. I can able to read the emp_id by {{ $employeeDetail->emp_id }}.