我如何访问集合实例

How can i access collection instance

如何访问这种类型的 属性? 当我尝试使用 foreach loop

访问时出现错误

Property [start_time] does not exist on this collection instance.

这是我尝试访问实例的函数:

$user = optional(Auth::user())->id;
        $values = DB::table('exchanges')
            ->leftJoin('trades', 'exchanges.id', '=', 'trades.exchange_id')
            ->where('trades.user_id', $user)
            ->get();
        $instance = array();
        foreach ($values as $value) {

            $instance[] = $values->start_time;

        }
        DD($instance);

这是DD(value)的结果;

{#1106 ▼
    +"id": 3
    +"exchange": "NSE"
    +"created_at": "2018-04-18 13:00:23"
    +"updated_at": "2018-08-14 06:48:24"
    +"deleted_at": null
    +"start_time": "09:00:00"
    +"close_time": "03:30:00"
    +"country_id": null
    +"user_id": 1
    +"symbol_id": 7
    +"exchange_id": 1
    +"market_id": 1
    +"is_action": 1
    +"rate": 13234
    +"tradedate": "2018-06-21 09:10:00"
    +"note": "Kinnari updated"
    +"quantities": 456
    +"stoploss": 6465
    } 

我可以看到有即时,但为什么我不能访问它?

您正在使用 $values 而不是 $value

    foreach ($values as $value) {

   // should be 
        $instance[] = $value->start_time;

    }