Laravel makes hard stuff really easy to do.

Imagine the case where you want to be able to login as a different user (a scenario which happens a lot during development). Instead of entering the credentials over and over again, you can do something like this:

if (app()->environment('local') {
Auth::logout();
 
$user = User::find(1); // Or a different query to get the correct user
 
Auth::login($user);
}

Just be aware that this can be a security issue, hence the check to make this work only in the local environment.

Never, ever, allow stuff like this on production.