Php 路由拉维误差
这是我的路线Php 路由拉维误差,php,Php,这是我的路线 Route::get('/', 'frontcontroller@index'); Route::get('/index.html', 'frontcontroller@index'); Route::get('/checkout.html', 'frontcontroller@checkout'); Route::get('/furniture.html', 'frontcontroller@furniture'); Route::get('/login.html', 'fron
Route::get('/', 'frontcontroller@index');
Route::get('/index.html', 'frontcontroller@index');
Route::get('/checkout.html', 'frontcontroller@checkout');
Route::get('/furniture.html', 'frontcontroller@furniture');
Route::get('/login.html', 'frontcontroller@login');
Route::get('/products.html', 'frontcontroller@products');
Route::get('/register.html', 'frontcontroller@register');
Route::get('/single.html', 'frontcontroller@single');
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::group(['prefix' => 'admin','middleware'=>'auth'], function () {
Route::get('/', function () {
return view('admin.index');
})->name('admin.index');
});
这是一个侧面导航:
{{-- Side Navigation --}}
<div class="col-md-2">
<div class="sidebar content-box" style="display: block;">
<ul class="nav">
<!-- Main menu -->
<li class="current"><a href="{{route('admin.index')}}"><i class="glyphicon glyphicon-home"></i>
Dashboard</a></li>
<li class="submenu">
<a href="#">
<i class="glyphicon glyphicon-list"></i> Products
<span class="caret pull-right"></span>
</a>
<!-- Sub menu -->
<ul>
<li><a href="{{route('admin.index')}}">Add Product</a></li>
</ul>
</li>
</ul>
</div>
</div> <!-- ADMIN SIDE NAV-->
为什么我会有这个问题
未定义路由[产品索引]。
(视图:C:\Users\Antonio\Desktop\uni\musicshop\resources\views\admin\layout\includes\sidenav.blade.php)
(视图:C:\Users\Antonio\Desktop\uni\musicshop\resources\views\admin\layout\includes\sidenav.blade.php)
(视图:C:\Users\Antonio\Desktop\uni\musicshop\resources\views\admin\layout\includes\sidenav.blade.php)
这是问题的代码:
您应该设置路由名称
路由::get('/products.html','frontcontroller@products)->名称('product.index') 请上传代码,不要上传代码图片。我上传代码@castisShow your routes,sidenav.blade.phpok我添加@aynberI看不到
product.index
任何地方,这就是它抱怨的地方。那在你的侧导航里吗?
/**
* Get the URL to a named route.
*
* @param string $name
* @param mixed $parameters
* @param bool $absolute
* @return string
*
* @throws \InvalidArgumentException
*/
public function route($name, $parameters = [], $absolute = true)
{
if (! is_null($route = $this->routes->getByName($name))) {
return $this->toRoute($route, $parameters, $absolute);
}
throw new InvalidArgumentException("Route [{$name}] not defined.");
}