Laravel 5,播种机没有找到类别

时间:2017-08-03 19:35:37

标签: php laravel-5

我正在使用播种机播种数据库表,使用faker来生成虚假数据。 我尝试了几个表,它工作得很好,现在我得到类未找到异常,即使该类存在于正确的名称空间。 这是播种机的代码

    <?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
                ]);
        }
   }  }

这是

的模型代码
  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');
      }
 }

致电php artisan db:seed --class=FoodDrinksCategorySeeder时 我得到以下[ReflectionException] Class FoodDrinksCategorySeeder does not exist

0 个答案:

没有答案