database/seeds/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()
    {
        Category::truncate();
        factory('App\User',20)->create();
        factory('App\Company',20)->create();
        factory('App\Job',20)->create();
        $categories = [
            'Technology',
            'Engineering',
            'Government',
            'Medical',
            'Construction',
            'Software'
        ];
        foreach($categories as $category){
            Category::create(['name'=>$category]);
        }
        Role::truncate();
        $adminRole = Role::create(['name' => 'admin']);
        $admin = User::create([
            'name'=>'admin',
            'email'=>'admin@gradserve.com',
            'password'=>bcrypt('password123'),
            'email_verified_at'=> NOW()
        ]);
        $admin->roles()->attach($adminRole);
    }
public function run ( ) { Category :: truncate ( ) ; factory ( 'App\User' , 20 ) -> create ( ) ; factory ( 'App\Company' , 20 ) -> create ( ) ; factory ( 'App\Job' , 20 ) -> create ( ) ; $ categories = [ 'Technology' , 'Engineering' , 'Government' , 'Medical' , 'Construction' , 'Software' ] ; foreach ( $ categories as $ category ) { Category :: create ( [ 'name' => $ category ] ) ; } Role :: truncate ( ) ; $ adminRole = Role :: create ( [ 'name' => 'admin' ] ) ; $ admin = User :: create ( [ 'name' => 'admin' , 'email' => 'admin@gradserve.com' , 'password' => bcrypt ( 'password123' ) , 'email_verified_at' => NOW ( ) ] ) ; $ admin -> roles ( ) -> attach ( $ adminRole ) ; }
Seed the application's database.
Seed the application ' s database .
// $this->call(UsersTableSeeder::class);