database/seeds/SubcategorySeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $categories = \App\Category::pluck('id');
        $categories->each(function ($category) {
            factory(\App\Subcategory::class)->times(rand(12, 28))->create([
                'category_id' => $category,
            ]);
        });
    }
public function run ( ) { $ categories = \ App \ Category :: pluck ( 'id' ) ; $ categories -> each ( function ( $ category ) { factory ( \ App \ Subcategory :: class ) -> times ( rand ( 12 , 28 ) ) -> create ( [ 'category_id' => $ category , ] ) ; } ) ; }
Run the database seeds.
Run the database seeds .