Sometimes you want to perform a chunk of code dependent on the environment. This trick makes it easy to check against multiple environments and returns a boolean.
if (App::environment(['local', 'staging'])) {
Route::get('test', 'TestController');
}
// or
if (app()->environment(['local', 'staging'])) {
Route::get('test', 'TestController');
}