Not sure what you are after but see if this post will help you any. http://laravel.io/forum/05-09-2015-clean-way-of-combining-an-array-for-a-listbox
I use the setVisible trick. Not sure if it's a good idea
public function getemployee(){
$id = $_POST['id'];
$employees = mot_users::where("branch_no", $id)->get();
foreach ($employees as $employee) {
$employee->setVisible(['user_no', 'firstname', 'lastname']);
}
return response()->json(['success' => true, 'employees' => $employees]);
}
I instead use this
$employees = mot_users::where("branch_no", $id)
->select(array('user_no', 'lastname', 'firstname'))
->get()->toArray();
return response()->json(['success' => true, 'employees' => $employees]);
yet now im having a problem on fetching the json data response as it returns me
[Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]
any ideas how to fetch that [object object] stuff?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community