We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
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:
<?php
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.
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.