In laravel 10 you can achieve that with breeze installed through the below code in the AuthenticatedSessionController
use Illuminate\Support\Facades\Redirect;
class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*
* @return \Illuminate\View\View
*/
public function create()
{
if (url()->previous() != url()->current()){
Redirect::setIntendedUrl(url()->previous());
}
return view(‘auth.login’);
}