I'm getting this error when I try to read the data inside a view that returned by controller. I tried to change it many times but I still get same result
This is the controller index function where I launch the query and view
syntax error, unexpected ')', expecting '[' (View: C:\project\laravel\project1\app\resources\views\products.blade.php)
public function index()
{
$data = DB::table('product')->get();
return view('products',["products"=>$data]);
}
and this is the view part where I try to parse it:
<ul>
@foreach (products as product )
<li>{{ product->name }}</li>
@endforeach
</ul>
if you have any idea or suggestion that s will be nice , thanks.