[英]Variables as Route Parameters (LARAVEL)
我正在尋求一些幫助,
我有一堆標簽,我想通過使用路由變量來動態化:
刀片片段:
<div class="project-card">
<a href="{{ route('title', ['project' => '1978-reel-boom'], app()->getLocale() ) }}" >
<img alt="1978 Reel Boom" title="1978 Reel Boom" src="{image}">
<p>1978 Reel Boom</p>
</a>
</div>
<div class="project-card">
<a href="{{ route('title', ['project' => '1979-cubus-diebach'], app()->getLocale() ) }}" >
<img alt="1979 Cubus Diebach" title="1979 Cubus Diebach" src="{image}">
<p>1979 Cubus Diebach</p>
</a>
</div>
我的路線如下所示:
Route::get('architectuur/{project}', ['as' => 'title', 'uses' => 'App\Http\Controllers\ArchitectureController@showProject'])->name('title');
但我收到此錯誤:
我的想法是我可以制作一個單獨的刀片頁面,該頁面將響應標題並根據標題顯示帶有來自該項目的圖像的輪播。 (沒有數據庫)
您只需定義路線的名稱,無需添加as
。
Route::get('architectuur/{project}', 'App\Http\Controllers\ArchitectureController@showProject')
->name('title');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.