I'm receiving an error while using the foreach loop in the blade.php. I have tried many things but everytime i recevie the same error while using foreachloop
Here is my code Post.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<ul>
@foreach($datafromtestmodel as $rows)
<li>
<p>{{$rows['name']}}</p>
<p>{{$rows['company']}}</p>
</li>
@endforeach
</ul>
</body>
</html>
Controller Function
public function index()
{
$testmodeldata = new testmodel;
$datafromtestmodel = $testmodeldata ->abc();
return view('post', compact('datafromtestmodel'));
}
Model Function
public function abc(){
$blabla = ['name' => 'abc', 'company' => 'abc company'];
return $blabla;
}
Route
Route::get('post','PostController@index');