简体   繁体   English

Laravel Artisan CLI url参数

[英]Laravel Artisan CLI url parameter

I am trying to run my newsletter via queue in Laravel. 我正试图通过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. 这是在CLI模式下运行的,因此URL帮助程序(如URL::route()等)正在使用环境app.php中指定的url paramenter。

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. 问题是,这个项目有两个URL地址,每个国家一个,语言不同,所以当我尝试发送时事通讯时,其中一个国家/地区会有其他国家/地区语言,因为应用中只能有一个网址。 PHP。

What I need is to have two URL adresses available at the time my queue is processing, or somehow switch them within job. 我需要的是在我的队列处理时有两个URL地址可用,或以某种方式在作业中切换它们。

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: 您不能有多个,但您可以通过执行以下app.url在运行时更改app.url

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

App::setRequestForConsoleEnvironment();

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

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