jeudi 3 août 2017

Laravel 5, class not found exception for a seeder

I'm using a seeder to seed a database table usinfg faker to generate fake data. I tried this for a couple of tables it worked just fine, now I'm getting class not found exception even though the class exists in the proper name space. here's the code for the seeder

    <?php

    use Illuminate\Database\Seeder;

    class FoodDrinksCategorySeeder extends Seeder {
        public function run(){
             $faker = \Faker\Factory::create();
             DB::table('category')->delete();
             for ($i = 0; $i < 50; $i++) {
                \App\FoodDrinksCategory::create([
                     'name_en' => $faker->name,
                      'discribtion_en' => $faker->name,
                      'name_ar' => $faker->name,
                      'discribtion_ar' => $faker->name
                ]);
        }
   }  }

and here's the Model code for

  namespace App;

  use Illuminate\Database\Eloquent\Model;

  class FoodDrinksCategory extends Model{

      protected $table = 'food_drinks_category';


      protected $fillable = 
              ['name_en','name_ar','decription_ar','decription_en'];

      public function drinks(){
          return $this->hasMany('App\Drink', 'food_drinks_types_id');
      }


      public function meals(){
         return $this->hasMany('App\Meal', 'food_drinks_types_id');
      }
 }

when calling php artisan db:seed --class=FoodDrinksCategorySeeder I get the following [ReflectionException] Class FoodDrinksCategorySeeder does not exist



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2vn1QTq
via IFTTT

Aucun commentaire:

Enregistrer un commentaire