简体   繁体   中英

Laravel Artisan CLI url parameter

I am trying to run my newsletter via queue in Laravel. So far, it's working, but I can't wrap my head around one problem.

This is running in CLI mode, so URL helpers like URL::route() and such are using url paramenter specified in environment app.php.

The problem is, this project has two URL adresses, one for each country, with different language, so when I would try to send the newsletter, one of the countries will have other country language, because there can be only one URL in app.php.

What I need is to have two URL adresses available at the time my queue is processing, or somehow switch them within job.

Does anybody have an idea how to solve this?

You cannot have more than one, but you can change the app.url in runtime by doing:

Config::set('app.url', 'http://example.com/en/');

App::setRequestForConsoleEnvironment();

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