database/seeders/DatabaseSeeder.php
/**
     * Seed the application's database.
     *
     * @return void
     */
Seed the application's database.
@return void
Seed the application ' s database . @return void
public function run()
    {
        $this->filesystem->cleanDirectory('storage/app/public');
        $categories = Category::factory()->count(3)->create();
        foreach ($categories as $category) {
            $authors = Author::factory()->count(4)->create();
            foreach ($authors as $author) {
                Article::factory(10)->create(['category_id'=>$category->id, 'author_id'=>$author->id]);
            }
        }
    }
public function run ( ) { $ this -> filesystem -> cleanDirectory ( 'storage/app/public' ) ; $ categories = Category :: factory ( ) -> count ( 3 ) -> create ( ) ; foreach ( $ categories as $ category ) { $ authors = Author :: factory ( ) -> count ( 4 ) -> create ( ) ; foreach ( $ authors as $ author ) { Article :: factory ( 10 ) -> create ( [ 'category_id' => $ category -> id , 'author_id' => $ author -> id ] ) ; } } }
Seed the application's database.
Seed the application ' s database .