我从我的数据库中获取了一个集合
$events = DB::table('events')
->select('id', 'eventId', 'resourceId', 'title', 'start', 'end')
->get();
Run Code Online (Sandbox Code Playgroud)
并想添加一个字段,color以便我可以根据该字段的值设置颜色值title。我的方法不起作用,echo并put给出了错误。
$events->put('color', 'blue');
$events->each(function($item, $key){
if($item == 'Garage')
echo $item;
});
Run Code Online (Sandbox Code Playgroud)