I'm using Laravel. Here is my array -
[{"emp_id":1,"shift":"first","status":"Present","is_unpaid":0,"start":"2018-03-21 08:00:00","end":"2018-03-21 12:00:00"},{"emp_id":2,"shift":"first","status":"Present","is_unpaid":0,"start":"2018-03-21 08:00:00","end":"2018-03-21 12:00:00"},{"emp_id":3,"shift":"first","status":"Present","is_unpaid":0,"start":"2018-03-21 08:00:00","end":"2018-03-21 12:00:00"},{"emp_id":4,"shift":"first","status":"Present","is_unpaid":0,"start":"2018-03-21 08:00:00","end":"2018-03-21 12:00:00"},{"emp_id":6,"shift":"first","status":"Present","is_unpaid":0,"start":"2018-03-21 08:00:00","end":"2018-03-21 12:00:00"},{"emp_id":7,"shift":"first","status":"Present","is_unpaid":0,"start":"2018-03-21 08:00:00","end":"2018-03-21 12:00:00"}]
And this is my array output code -
if(empty($employee->emp_record) ){
$sheet = array();
}else{
$sheet = unserialize($employee->emp_record);
}
return $sheet;
I want to get value of emp_id and show in the view. When I use return $sheet->emp_id;
Trying to get property of non-object This error happened.
emp_idso you need to choose which one to return or access like thisreturn $sheet[0]->emp_id;var_export($sheet);?