未找到 InvalidArgumentException 视图 [admin.products.view_products]。在 laravel 5.7
InvalidArgumentException View [admin.products.view_products] not found. in laravel 5.7
我试图在管理面板中显示数据库记录,但它向我显示错误:未找到 InvalidArgumentException 视图 [admin.products.view_products]。有什么解决办法吗??
我的功能是:
public function viewProducts(){
$products = Product::get();
$products = json_decode(json_encode($products));
//echo "<pre>"; print_r($products); die;
return view('admin.products.view_products')->with(compact('products'));
}
路线是:
Route::get('/admin/view-products','ProductsController@viewProducts');
这是表格:
<thead>
<tr>
<th>Product ID</th>
<th>Category ID</th>
<th>Product Name</th>
<th>Product Code</th>
<th>Product Color</th>
<th>Price</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach($products as $product)
<tr class="gradeX">
<td>{{ $product->id }}</td>
<td>{{ $product->category_id }}</td>
<td>{{ $product->product_name }}</td>
<td>{{ $product->product_code }}</td>
<td>{{ $product->product_color }}</td>
<td>{{ $product->price }}</td>
<td class="center"><a href="{{ url('/admin/edit-product/'.$product-
>id) }}" class="btn
btn-primary btn-mini">Edit</a> <a id="delCat" href="{{ url('/admin/delete-
product/'.$product->id) }}" class="btn btn-danger btn-mini">Delete</a></td>
</tr>
@endforeach
您的视图文件必须在
resources/admin/products directory
名为 view_products.blade.php
控制器
public function viewProducts(){
$data['products'] = Product::all();
return view('admin.products.view_products',$data);
}
我试图在管理面板中显示数据库记录,但它向我显示错误:未找到 InvalidArgumentException 视图 [admin.products.view_products]。有什么解决办法吗??
我的功能是:
public function viewProducts(){
$products = Product::get();
$products = json_decode(json_encode($products));
//echo "<pre>"; print_r($products); die;
return view('admin.products.view_products')->with(compact('products'));
}
路线是:
Route::get('/admin/view-products','ProductsController@viewProducts');
这是表格:
<thead>
<tr>
<th>Product ID</th>
<th>Category ID</th>
<th>Product Name</th>
<th>Product Code</th>
<th>Product Color</th>
<th>Price</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach($products as $product)
<tr class="gradeX">
<td>{{ $product->id }}</td>
<td>{{ $product->category_id }}</td>
<td>{{ $product->product_name }}</td>
<td>{{ $product->product_code }}</td>
<td>{{ $product->product_color }}</td>
<td>{{ $product->price }}</td>
<td class="center"><a href="{{ url('/admin/edit-product/'.$product-
>id) }}" class="btn
btn-primary btn-mini">Edit</a> <a id="delCat" href="{{ url('/admin/delete-
product/'.$product->id) }}" class="btn btn-danger btn-mini">Delete</a></td>
</tr>
@endforeach
您的视图文件必须在
resources/admin/products directory
名为 view_products.blade.php
控制器
public function viewProducts(){
$data['products'] = Product::all();
return view('admin.products.view_products',$data);
}