Search code examples
phplaravellaravel-5laravel-artisanartisan-migrate

Class 'Users' not found when running artisan migration


I am trying to run

project$ php artisan migrate:refresh

but get the error

[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Users' not found

Why do I need a Users class? I already have 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 {

[...]

and my migration, 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();
        });
    }

    [...]

My config/auth.php also has 'model' => 'App\User'. I tried running project$ composer dump-autoload. The User class is being defined. Why do I need a Users class?


Solution

  • Fixed. I dropped my database and went ahead and made a new one with the same name, then:

    project$ php artisan migrate
    Migration table created successfully.