Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Category::truncate();
     $categories = [['name' => 'Programming'], ['name' => 'Foreign Language'], ['name' => 'Discover'], ['name' => 'News'], ['name' => 'Relax']];
     foreach ($categories as $category) {
         factory(Category::class)->create($category);
     }
 }
Ejemplo n.º 2
0
 public function run()
 {
     Category::truncate();
     factory(Category::class, 'asset-category', 10)->create();
     factory(Category::class, 'accessory-category', 5)->create();
     factory(Category::class, 'consumable-category', 5)->create();
     factory(Category::class, 'component-category', 5)->create();
 }
Ejemplo n.º 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Category::truncate();
     $categoryNames = ['coding', 'social', 'faith', 'health', 'minimalism'];
     foreach ($categoryNames as $name) {
         $category = new Category(['name' => $name]);
         $category->user()->associate(User::first());
         $category->save();
     }
 }