Search code examples
phplaravelemailnotificationslaravel-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

It's wrong

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

How can I solve it?


Solution

  • 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