thank you for the answer, but that doesn't seem to be my intention.
what I mean is to test the connection to the database, which I got like this:
if (DB::connection()->getPdo() == TRUE) {
echo "Connection to database successful";
} else {
echo "Connection to database failed";
}
but the code above directly retrieves data from the .env file, which causes if there is an error in the user and password cannot handle (SQLSTATE[HY000] [1045] Access denied for user 'testuser'@'localhost' (using password: YES)).
I want:
('test the connection to the database with a user and password') ? 'proceed to the next stage' : 'Enter the correct user and password';
can i test it first like the code above, before i put it in the .env file?