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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners