简体   繁体   English

如何在邮件通知系统上使用基本URL? (Laravel 5.3)

[英]How to use base url on mail notification system ? (Laravel 5.3)

My code is like this : 我的代码是这样的:

public function toMail($notifiable)
{
    return (new MailMessage)
                ->subject('Test')
                ->greeting('Hello '.$notifiable->store->name.'!')
                ->line('Test 1')
                ->line('Test 2')
                ->action('Check Order',url('member/store/sale'))
                ->line('Thanks');
}

When I click the action, it will call http://localhost/member/store/sale 当我单击该操作时,它将调用http:// localhost / member / store / sale

It's wrong 这是不对的

Should, it call http://myshop.dev/member/store/sale 应该,它调用http://myshop.dev/member/store/sale

How can I solve it? 我该如何解决?

Calling url() should work perfectly. 调用url()应该可以正常工作。 But did you update the .env file for setting app url? 但是你更新了.env文件来设置app url吗?

Edit your .env 编辑你的.env

APP_URL=http://myshop.dev/

and then clear cache 然后清除缓存

php artisan config:cache

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM