问题:SQLSTATE[42S02]: Base table or view not found: 1146 table 'db_wls. sql(SQL: select count(*) as aggregate from users
where email
= onlynadim0000@gmail.com)
模型类
<?php namespace App;
use Illuminate'Auth'Authenticatable;
use Illuminate'Database'Eloquent'Model;
use Illuminate'Auth'Passwords'CanResetPassword;
use Illuminate'Contracts'Auth'Authenticatable as AuthenticatableContract;
use Illuminate'Contracts'Auth'CanResetPassword as CanResetPasswordContract;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
use Authenticatable, CanResetPassword;
/**
* The database table used by the model.
*
* @var string
*/
public $table = 'user';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['first_name','last_name', 'email', 'password','address','city_id'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
public function voucher()
{
return $this->hasOne('App'Voucher');
}
public function getFullName()
{
return ucfirst(implode(" ",[$this->usr_firstname,$this->usr_lastname]));
}
}
用户表在数据库中确实存在。为什么会出现这个错误。
Thanks In advance
你可以在你的模型中覆盖它。
public $table = 'users'
检查数据库。没有名为"users"的表,因此出现错误。