I’m beginner in laravel; I’m trying to create an API of devices. When I try the API, it says there is no such table named devices. Any help would be appreciated.
Please check the .env file and make sure that you se the database connection in a correct way.
First check the DB_CONNECTION in your case it must be mysql. then check other database connection variables value such as below
DB_CONNECTION=mysql
DB_HOST=Here write your database host such as "localhost" or 127.0.0.1
DB_PORT=Here write the database port default value for mysql is 3306
DB_DATABASE=Here write the database name in your case write "blog"
DB_USERNAME=Here write the database username default is "root"
DB_PASSWORD=Here write the database password or leave it empty if there is no password.
Make sure to write all values without " or ‘ or spaces.
2
Answers
Please check the .env file and make sure that you se the database connection in a correct way.
First check the
DB_CONNECTION
in your case it must be mysql. then check other database connection variables value such as belowMake sure to write all values without " or ‘ or spaces.
You are using SQLITE in yout .env, try change to: DB_CONNECTION=mysql and check others enviroment from you make a correct connection