Modules/Users/Database/Seeds/UserTableSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        \Modules\Users\Models\User::truncate();
        \Modules\Users\Models\Group::truncate();
        $startUpGroup = Group::firstOrCreate([
            'name' => 'iStars',
            'reserved' => true
        ]);
        factory(\Modules\Users\Models\User::class, 10)->create()->each(function ($u) use($startUpGroup) {
            $u->groupsBelongingTo()->attach($startUpGroup->id);
            $u->posts()->create([
                'content' => 'Testing post seeds from ' . $u->fullName()
            ]);
        });
    }
public function run ( ) { \ Modules \ Users \ Models \ User :: truncate ( ) ; \ Modules \ Users \ Models \ Group :: truncate ( ) ; $ startUpGroup = Group :: firstOrCreate ( [ 'name' => 'iStars' , 'reserved' => true ] ) ; factory ( \ Modules \ Users \ Models \ User :: class , 10 ) -> create ( ) -> each ( function ( $ u ) use ( $ startUpGroup ) { $ u -> groupsBelongingTo ( ) -> attach ( $ startUpGroup -> id ) ; $ u -> posts ( ) -> create ( [ 'content' => 'Testing post seeds from ' . $ u -> fullName ( ) ] ) ; } ) ; }
Run the database seeds.
Run the database seeds .
/**
             * @var User $u
             */