嗨,在我创建存储方法后,我使用了每个控制器方法作为一个方法,所以我在Route::resource上更改了它,我想翻译路由名称,所以我使用了AppService提供程序,并将斯洛伐克语添加到路由中,但现在我有问题了,我的路由很好,但它不工作。我有每个锦标赛页面空和弹头,不是用来与空白页面工作。在空白页面上是导航栏和我的刀片,没有来自数据库的数据。
谢谢你的建议。
例如,控制器中的my方法之一
public function show(Tournament $tournament)
{
return view('tournaments.show', [
'tournament' => $tournament,
'regions' => Region::where("id", "=", $tournament->region_id)->get(),
]);
}我的路线
Route::resource('turnaje', TournamentController::class)
->parameters([
'tournaments' => 'tournaments:slug'
])->only([
'create', 'store', 'edit', 'update', 'destroy'
])->middleware('auth');
Route::resource('turnaje', TournamentController::class)
->only([
'index', 'show',
]);AppServiceProvider
public function boot()
{
Route::resourceVerbs([
'create' => 'pridat',
'edit' => 'editovat',
]);
}我的刀锋
div class="container mx-auto">
<h1 class="title text-center text-4xl pt-8">{{ $tournament->title }}</h1>
<h2 class="title text-2xl">{{ $tournament->city }}</h2>
<h3>{{ $tournament->street }}</h3>
<p class="mt-8">{!! $tournament->text !!}</p>
</div>发布于 2021-01-30 23:53:43
如果你找到更好的东西,它可能是这样的
Route::get('/turnaje', [TournamentController::class, 'index']);
Route::get('/turnaj/pridat', [TournamentController::class, 'create'])
->middleware('auth');
Route::get('/turnaj/{tournament}', [TournamentController::class, 'show']);
Route::resource('turnaje', TournamentController::class)->parameters([
'tournaments' => 'tournaments:slug'
])->except(['index', 'show', 'create'])->middleware('auth');https://stackoverflow.com/questions/65969480
复制相似问题