1

I have a little problem trying to seed my comments table. I'm 100% sure that I have the Class CommentTableSeeder.php in my /database/seeds directory.


CommentTableSeeder.php

<?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class CommentTableSeeder extends Seeder {

    public function run()
    {
        DB::table('comments')->delete();

        Comment::create(array(
            'author' => 'Chris Sevilleja',
            'text' => 'Look I am a test comment.'
        ));

        Comment::create(array(
            'author' => 'Nick Cerminara',
            'text' => 'This is going to be super crazy.'
        ));

        Comment::create(array(
            'author' => 'Holly Lloyd',
            'text' => 'I am a master of Laravel and Angular.'
        ));
    }

}

Then when I run : php artisan db:seed

I kept getting

enter image description here

I've also try running composer update and run : php artisan db:seed - still get the same result.

Any hints / help will be much appreciated !

5
  • 1
    Did you run composer dump-autoload before trying this? Commented Aug 4, 2015 at 13:40
  • Not yet, ok. I'll do it now. Commented Aug 4, 2015 at 13:40
  • Working now. Thank you very much for your help. :) Commented Aug 4, 2015 at 13:42
  • No problem, going to add it as an answer for completions sake. Commented Aug 4, 2015 at 13:44
  • Sure. go for it. I'll make sure to accept it. Commented Aug 4, 2015 at 13:44

1 Answer 1

2

You need to run

composer dump-autoload

to fix this error. What this does, among other things, is refreshes the list of classes available to your application.

In this case, while the class did exist in the right location, it was unavailable in your autoloaded class list, and thus returning a Not Found error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.