samhu kiklsk samhu kiklsk - 1 year ago 135
PHP Question

Laravel seeder gives error. Class not found

I'm a newbie in Laravel and and I'm teaching myself how to authenticate from a login table. I have migrated and created the table. Now, I'm trying to seed the data into the login table, but the command prompt is continuously giving me error, which says

Fatal Error, class login not found
and I have no idea what i have missed. So can anyone please help me. Here is the code that i have, and yes I'm using Laravel 4.3

class loginTableSeeder extends Seeder
public function run()
'username' => 'sanju',
'password' => Hash::make('sanju')


Answer Source

You need to create an Eloquent model for that table in order to use Login::create(). You can do that with a simple artisan command:

$ php artisan generate:model Login

This will generate a new Eloquent model in app/models directory which should look like this.

class Login extends Eloquent {

    protected $fillable = [];
    protected $table = 'login';


Your code should work after that. If it still doesn't make sure you run composer dump-autoload.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download