Class 'Users' 运行 artisan 迁移时未找到
Class 'Users' not found when running artisan migration
我正在尝试 运行
project$ php artisan migrate:refresh
但得到错误
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Users' not found
为什么我需要 Users
class?我已经有 app/User.php
:
<?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 {
[...]
和我的迁移,database/migration/2015_05_27_143124_create_users_table
:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('username')->unique();
[...]
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
});
}
[...]
我的config/auth.php
还有'model' => 'App\User'
。我试过 运行宁 project$ composer dump-autoload
。正在定义 User
class。为什么我需要 Users
class?
已修复。我删除了我的数据库并继续创建了一个同名的新数据库,然后:
project$ php artisan migrate
Migration table created successfully.
我正在尝试 运行
project$ php artisan migrate:refresh
但得到错误
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Users' not found
为什么我需要 Users
class?我已经有 app/User.php
:
<?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 {
[...]
和我的迁移,database/migration/2015_05_27_143124_create_users_table
:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('username')->unique();
[...]
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
});
}
[...]
我的config/auth.php
还有'model' => 'App\User'
。我试过 运行宁 project$ composer dump-autoload
。正在定义 User
class。为什么我需要 Users
class?
已修复。我删除了我的数据库并继续创建了一个同名的新数据库,然后:
project$ php artisan migrate
Migration table created successfully.