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