Categories Games

Why is it important to change APP_URL in Laravel .env file – Quick Admin Panel


By default, a Laravel installation comes with a .env.example file, which has default values APPLICATION_URL=. I see a lot of people forget to change it to your app’s original URL, why is this important?

To be precise, this value is actually used config/app.phplike this:


'url' => env('APP_URL', '

So, you can call that value with config(‘app.url’).

The funny thing is, your app will still work even if you don’t change the URL. Problems will arise when using multiple function calls config(‘app.url’) or directly env(‘APP_URL’).

Within Laravel itself, you can find this:

In short, yours email notification will point to the wrong URL, if you don’t set it up correctly.

Also, console command won’t work properly, because the console doesn’t actually know what the URL is, because it’s not called from the browser.


But that’s not all. Many external package depend on APPLICATION_URL arrangement. For example, the very popular Spatie Media Library for uploading files (which we use inside our QuickAdminPanel), uses a configured APP_URL to form the URL of the actual file to be returned.

For example, if you call this:


$user->getFirstMediaUrl('main_photo');

This will use APP_URL to form the final URL. And if you let it instead of the actual URL, you might get a broken file or 404 image on your website.

So, my advice is to always change APPLICATION_URL in you .env files immediately after project installation – on your local computer, and all servers – staging or live.

Read more about Laravel configuration in the official documentation.



Teknologi Terkini

Agen Togel Terpercaya

Bandar Togel

Sabung Ayam Online

Berita Terkini

Artikel Terbaru

Berita Terbaru

Penerbangan

Berita Politik

Berita Politik

Software

Software Download

Download Aplikasi

Berita Terkini

News

Jasa PBN

Jasa Artikel

News

Breaking News

Berita

More From Author