简体   繁体   中英

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

It's wrong

Should, it call http://myshop.dev/member/store/sale

How can I solve it?

Calling url() should work perfectly. But did you update the .env file for setting app url?

Edit your .env

APP_URL=http://myshop.dev/

and then clear cache

php artisan config:cache

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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