Error:
照亮\数据库\QueryException (42S02)
SQLSTATE[42S02]: 未找到基表或视图: 1146 表 'mmictltd.admins' 不存在 (SQL: select * fromadmins
where email
= [电子邮件受保护] /cdn-cgi/l/email-protection限制 1)
My 创建_管理_表.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAdminTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('admin', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('admin');
}
}
Laravel 错误图解 https://i.stack.imgur.com/eYpjQ.png
您的迁移表名为“admin”,但在查询中您正在寻找“admins”。
您可以通过 $table 在模型中指定表名称:
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'admin';
Laravel 约定在这种情况下表名应该是复数:https://laravel.com/docs/5.6/eloquent https://laravel.com/docs/5.6/eloquent
因此,我建议您将迁移从“admin”更改为“admins”。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)