Forge Command not using right URL

Posted 1 year ago by packy

This is quite frustrating. I have a command that runs a notification that uses the URL function to have a link in an email. When I use a function in controller and hit a route to send the notification the URL returns the correct link, when the command is run in the correct URL is ran, when the command is ran on the production site it returns http://localhost

The part of the notication with the URL ->action('View WOD', url( 'leagues/' . $this->league->id) );

My ENV file on production server

My app config file 'url' => env('APP_URL'),

In my command (when this is ran it notification returns localhost):

$athlete->notify( new WodStarts( $league ) );

in API Controller to run manually to test (when this is ran it notification returns url from env file)

$athlete->notify( new WodStarts( $league ) );

What I have already checked:

  • I deleted the defualt site
  • I deleted the scheduler that ran on the default site
  • I checked both env files for the 2 sites (production is and dev is
  • I cant find any reference to localhost
  • Notification DO use right URL from Dev site
  • Notification DO use right URL on production when ran from controller
  • Notifications DO NOT use right URL when ran from command in production

What is going on? Where is it finding localhost and why would a notification use the right url from a controller but not a command???

Please sign in or create an account to participate in this conversation.