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(Faker $faker)
    {
        for ($i = 0; $i < 20; $i++) {
            $newCategory = new Category();
            $newCategory->name = $faker->jobTitle();
            $slug = "$newCategory->name-$i";
            $newCategory->slug = Str::slug($slug, '-');
            $newCategory->save();
        }
    }
public function run ( Faker $ faker ) { for ( $ i = 0 ; $ i < 20 ; $ i ++ ) { $ newCategory = new Category ( ) ; $ newCategory -> name = $ faker -> jobTitle ( ) ; $ slug = " $ newCategory -> name - $ i " ; $ newCategory -> slug = Str :: slug ( $ slug , '-' ) ; $ newCategory -> save ( ) ; } }
Run the database seeds.
Run the database seeds .