database/seeders/ProductSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $faker = Faker::create();
        foreach(range(1,20) as $value) {
            DB::table('products')->insert([
                'name' => 'Product-' . Str::random(6),
                'price' => $faker->numberBetween(1,100),
                'quantity' => $faker->numberBetween(1,50),
                'image' => Str::random(6) . '.png'
            ]);
        }
    }
public function run ( ) { $ faker = Faker :: create ( ) ; foreach ( range ( 1 , 20 ) as $ value ) { DB :: table ( 'products' ) -> insert ( [ 'name' => 'Product-' . Str :: random ( 6 ) , 'price' => $ faker -> numberBetween ( 1 , 100 ) , 'quantity' => $ faker -> numberBetween ( 1 , 50 ) , 'image' => Str :: random ( 6 ) . '.png' ] ) ; } }
Run the database seeds.
Run the database seeds .