1

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?

Farzin Bidokhti
  • 71
  • 1
  • 10

1 Answers1

0

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";
        }
    }
Farzin Bidokhti
  • 71
  • 1
  • 10