【问题标题】:Symfony\Component\Routing\Exception\RouteNotFoundException Route [download] not definedSymfony\\Component\\Routing\\Exception\\RouteNotFoundException 路由 [下载] 未定义
【发布时间】:2022-12-16 00:28:46
【问题描述】:

index.blade.php

<li><a class="dropdown-item" href="{{ route('download', $country->file) }}">Download</a></li>

路线

Route::post('download{file}', [DocumentController::class, 'download']);

控制器

public function download(Request $request, $file)
{
    $data = Country::all();
    
    return response()->download(public_patch('asset/'.$file));
}

【问题讨论】:

标签: laravel routes


【解决方案1】:

你的路线应该是这样的

Route::post('/download/{file}', [DocumentController::class, 'download'])->name('download');

【讨论】:

    猜你喜欢
    • 2021-11-24
    • 2022-01-05
    • 2021-09-10
    • 2020-12-14
    • 2014-11-18
    • 2019-08-02
    • 2021-05-28
    • 2020-05-15
    相关资源
    最近更新 更多