by Devin Yang
(This article was automatically translated.)

Published - 2 years ago ( Updated - 2 years ago )

This article uses Laravel 9.40.1 for operation. I believe many people know the usage of --env, but I still provide some information for Laravel beginners.
In the artisan command, we can use --env to specify different .env files, so that under different subdomains, I can use different environments or even different databases.
You should have also noticed that this site uses a multilingual environment, do you write two sets?
Of course not, basically I built multiple .env in the same Project.

So when I use tinker, which one should I connect? Just use the --env specification to see the picture directly 🙂


As an aside, tinker can be used directly in the screen because aliases are set in the default environment of phpenv.
The alias of phpenv is set as follows:

alias tinker='/usr/local/bin/php /var/www/html/artisan tinker'

What is the advantage of such an absolute path? He means that no matter where your path is, he can execute normally. 😉

Tags: Laravel artisan

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


dlaravel

Description of .env.example file on D-Laravel

This article explains about the .env settings on D-Laravel MYSQL_ROOT_PASSWORD=secret LARAVEL_INSTALLER='container' DOCKER_SERVICES='docker-compose.yml service/redis.yml'

laravel,dotenv,seo

How do I dynamically load different dotenv files in Laravel according to the subdomain name

Before we start, let me complain. Originally, my website could automatically display different languages ​​according to the user's browser. That's okay, but Google's SEO doesn't seem to like it. He recommends using different URLs for each language and not using cookies or browser settings to adjust the content of the page. Well, I'll just be obedient. His suggested method, the first solution: distinguish by country, such as example.tw or example.de, how is this really impossible, or buy the registered domain name, or take all the domain names and no one will take it The strange domain name is more likely. The second solution: use sub-domain names to distinguish, this is what I am going to do, and so on to explain how to do it in Laravel. The third solution: example.com/tw/ and the like, Apple seems to do it this way. The fourth solution: site.com?loc=tw and the like are not recommended, indeed I think this is not a good idea.

dlaravel

Super easy to use HTML to PDF kit mpdf introduction

During development, will it be necessary to output HTML to PDF? This video introduces how to output PDF on the screen through the mpdf library of php.