When I want to get a member of an array and assign it to a variable it returns error to me: Undefined offset: 0
$answers=Answer::where(
[
['questionid', '=', $question['questionid']],
['uniqid','=',$uniqCode]
]
)->get()
->toArray();
$answer=$answers[0]['answer'];
but when I print it exactly before assignment it returns the value correctly:
dd($answers[0]['answer']) ;
$answer=$answers[0]['answer'];