我是laravel的新手,我的一个网络路由遇到了麻烦…
我将一些路由与认证中间件分组
Route::middleware(['auth:web'])->group(function ($router) {
Route::get('/news', [NewsController::class, 'news'])->name('news');
Route::get('/profile/{user_id}', [ProfileController::class, 'profile'])->name('profile');
Route::get('/marketplace', [MarketplaceController::class, 'marketplace'])->name('marketplace');
});
在此问题之前,我为news
路由设置了一个user_id
参数,然后在第二天将其删除,现在news
路由一直返回错误,说它需要user_id
。
这是我的控制器:
<?php
namespace AppHttpControllers;
class NewsController extends Controller
{
public function news() {
return view('modules.news.news');
}
}
,因为我使用larvel -vue混合,我的modules.news.news
视图看起来像这样:
@section('content')
<newsfeed inline-template>
<div>
...
...
</div>
</newsfeed>
@endsection
我已经检查了web路由,控制器,刀片,我真的看不到任何需要news
路由接收参数的东西。
你的路由文件可能被缓存,试着运行php artisan route:clear,看看是否能解决这个问题。