I am just very new to laravel and today I have run some code and get stuck at this code.
$topic = topic::where('id', $id)->get();
if(is_array($topic)){
echo 'yes';
}
else{
echo 'no';
}
The result is 'no' but I can "foreach" loop through each topic.
As I unserstand, 'Foreach' accepts only array parameter but if it's a real array why is_array return "no"?
foreach. Anything that is Traversable can be iterated over withforeach(as well as arrays)