简体   繁体   中英

Laravel : QueryException in Connection.php line 770:

i want create api with laravel put when test my url in postman i have error this is my database 在此处输入图片说明

the error :

QueryException in Connection.php line 770: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'new_database.accounts' doesn't exist (SQL: insert into accounts ( name , updated_at , created_at ) values (ammar, 2017-02-09 13:59:24, 2017-02-09 13:59:24))

Your table is account and Laravel want to insert into table accounts (plural).

2 things to do to solve this problem

  • rename your table from account into accounts

or

  • add in your model protected $table = 'account';

在错误为“ new_database.accounts ”的屏幕快照“ new_database.acount”中,检查您的查询

Your table name is account and you are referring it with accounts . Change this and try again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM