database/seeders/UserSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS=0');
        User::truncate();
        DB::statement('SET FOREIGN_KEY_CHECKS=1');
        $users = [
            ['name'=>'bobette','email'=>'bob@sull.com','password'=>'epfcepfc'],
            ['name'=>'octavius','email'=>'octo@sull.com','password'=>'epfcepfc'],
            ['name'=>'red-partner','email'=>'partner@sull.com','password'=>'epfcepfc'],
        ];
        foreach($users as &$data) {
            $data['password'] = Hash::make($data['password']);
        }
        unset($data);
        DB::table('users')->insert($users);
    }
public function run ( ) { DB :: statement ( 'SET FOREIGN_KEY_CHECKS=0' ) ; User :: truncate ( ) ; DB :: statement ( 'SET FOREIGN_KEY_CHECKS=1' ) ; $ users = [ [ 'name' => 'bobette' , 'email' => 'bob@sull.com' , 'password' => 'epfcepfc' ] , [ 'name' => 'octavius' , 'email' => 'octo@sull.com' , 'password' => 'epfcepfc' ] , [ 'name' => 'red-partner' , 'email' => 'partner@sull.com' , 'password' => 'epfcepfc' ] , ] ; foreach ( $ users as & $ data ) { $ data [ 'password' ] = Hash :: make ( $ data [ 'password' ] ) ; } unset ( $ data ) ; DB :: table ( 'users' ) -> insert ( $ users ) ; }
Run the database seeds.
Run the database seeds .
//Empty the table first //Define data //Insert data in the table