Laravel database connection problem
1. Modify the configuration file / .nev
DB_HOST=127.0.0.1 / / database address DB_PORT=3306 / / database port DB_DATABASE=database / / database name DB_USERNAME=root / / database account DB_PASSWORD=root / / database password
two。 Start testing whether the connection is successful
/ App/Http/routes.php routing code is as follows (can be customized)
Route::get ('dbtest','Admin\ IndexController@dbtest')
3. New IndexController Controller
/ App/Http/Controllers/IndexController controller code is as follows (can be customized)