我使用 Laravel 创建了一个简单的电子邮件功能,用户收到一封电子邮件,在该电子邮件中我想调用一个下载文件的路由。
我的可邮寄:
class AppSent extends Mailable
{
use Queueable, SerializesModels;
public $name = '';
public function __construct(String $name)
{
$this->name = $name;
}
public function build()
{
return $this->from(env('MAIL_USERNAME'))
->markdown('emails.download.android_app');
}
}
单击按钮时,我在 DownloadController 中调用此函数,该函数会向用户发送电子邮件:
return Mail::to($request->email)->queue(new AppSent($request->name));
这是用户获得的降价视图(电子邮件视图):
@component('mail::message')
Hi,
Downloadlink created
@component('mail::button', ['url' => 'https://myapp.com/download'])
Download!
@endcomponent
@endcomponent
这是我需要调用以下载 zip 文件的路线:
public function download(Request $request)
{
return response()->download(
storage_path('/app/uploaded_apps/' . $request->name . '.zip')
);
}
如何在我的下载刀片视图中添加参数以下载具有给定名称的特定文件?