If you are testing your application and you need to make your config constant or change it to a specific value for testing you can mock it simply! Config facade of Laravel has a method named set() which overwrites the default value of configs like this: Config::set('name', 'Laravel'); Enter fullscreen mode So in testing env you can do something like this: public function test_that_home_page_is_working() { Config::set('name', 'Laravel'); $this->get('/')->assertSee("Laravel"); } In general of of benefits of using Facades in Laravel is because of their testability. You can https://laravel.com/docs/9.x/mocking all facades of Laravel easily.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners