Here is what I try to do:
$q = Question::where('id',$id -> id)->get();
$q[] = $q->push([ 'test' => true]);
dd($q);
This will output:
Collection {#220 ▼
#items: array:3 [▼
0 => Question {#225 ▶}
1 => array:1 [▼
"test" => true
]
2 => null
]
}
So 'test' => true
will append as a new key, but I want to insert it in Question
so latter I can access to it like this with foreach $q -> test
So here is how I want access to item:
@foreach($q as $qq)
{{ $qq->test }}
@endforeach
find
is possible then to add new random attribut? to existing object – Leadsman