I use query builder for select data from DB. My query builder is :
$end_date = DB::table('synon_library_lending')
->where('end_date', '<', Carbon::today())
->pluck('end_date', 'id');
and the result of this query is: {"4":"2019-07-03","5":"2019-07-04"} My problem is: i can't parse the above statement in php? What's your solution for this problem?
For show result of query builder use foreach like this code:
$lists = User::orderBy('first_name')
->orderBy('last_name')->get();
if ($lists->count()) {
foreach ($lists as $item) {
$list[$item->id] = "$item->first_name $item->last_name";
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.