Php 无法将Illumb\Databasemodel\Model用作模型,因为该名称已在使用中
我的数据库中有一些数据,我想通过迁移来保存,我正在使用iSeed来帮助我从这些数据中产生种子。但是,当我尝试使用Php 无法将Illumb\Databasemodel\Model用作模型,因为该名称已在使用中,php,laravel,Php,Laravel,我的数据库中有一些数据,我想通过迁移来保存,我正在使用iSeed来帮助我从这些数据中产生种子。但是,当我尝试使用 php artisan db:seed 我得到一个错误,它说: PHP致命错误:无法使用illumb\DatabaseModel\Model作为模型,因为该名称已在第7行的laravel/app/User.PHP中使用 因此,我进入User.php,并更改了这一行(实际上是第6行,而不是第7行): 为此: use Illuminate\Database\Eloquent\Mo
php artisan db:seed
我得到一个错误,它说:
PHP致命错误:无法使用illumb\DatabaseModel\Model作为模型,因为该名称已在第7行的laravel/app/User.PHP中使用
因此,我进入User.php,并更改了这一行(实际上是第6行,而不是第7行):
为此:
use Illuminate\Database\Eloquent\Model as BaseModel;
我还将其更改为扩展BaseModel而不是Model。
奇怪的是,我仍然得到相同的错误,仍然是User.php。我已经尝试运行composer dumpautoload,但这没有帮助。就我的理解而言,使用它作为BaseController应该已经解决了这个问题,但它没有。我做错了什么?谢谢你的帮助
编辑:包括模型的完整代码
<?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\DatabaseModel\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
*/
protected $table = 'users';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name', 'email', 'password'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
}
是否确实看到此特定错误?因为在Laravel中没有类似于illighte\DatabaseModel\Model
这样的名称空间,所以我很确定——我直接从浏览器窗口复制并粘贴了它。我确实注意到名称空间看起来有点奇怪,但我对laravel没有太多经验,所以我认为这是幕后发生的事情。你能展示你模型的全部代码吗?@max.lanin我已经编辑了这个问题,以包含完整的模型代码。删除这一行use illumb\DatabaseModel\model代码>
<?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\DatabaseModel\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
*/
protected $table = 'users';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name', 'email', 'password'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
}