Here is what I am trying to do:
$q = Question::where('id',$id -> id)->get();
$q[] = $q->push([ 'test' => true]);
dd($q);
This will output:
Collection {
0 => Question {
1 => array:1 [▼
"test" => true
]
2 => null
]
}
So it 'test' => truewill be added as a new key, but I want to insert it into Question, so I can access it like this with foreach$q -> test
So here is how I want to access the element:
@foreach($q as $qq)
{{ $qq->test }}
@endforeach
source
share