database/seeders/ItemSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        if (DB::table('item')->count() < 1) {
            DB::table('item')->insert([
                [
                    'nama'          =>  'Mouse Logitech G566',
                    'harga'         =>  150000,
                    'stok'          =>  100,
                    'created_at'    =>  now(),
                    'updated_at'    =>  now()
                ],
            ]);
            DB::table('item')->insert([
                [
                    'nama'          =>  'Keyboard Logitech KL566',
                    'harga'         =>  250000,
                    'stok'          =>  1440,
                    'created_at'    =>  now(),
                    'updated_at'    =>  now()
                ],
            ]);
            DB::table('item')->insert([
                [
                    'nama'          =>  'Laptop Asus PV356',
                    'harga'         =>  6599999,
                    'stok'          =>  55,
                    'created_at'    =>  now(),
                    'updated_at'    =>  now()
                ],
            ]);
            DB::table('item')->insert([
                [
                    'nama'          =>  'Monitor LG G739',
                    'harga'         =>  4500500,
                    'stok'          =>  11,
                    'created_at'    =>  now(),
                    'updated_at'    =>  now()
                ],
            ]);
            DB::table('item')->insert([
                [
                    'nama'          =>  'Headset Razer PX34G5',
                    'harga'         =>  230000,
                    'stok'          =>  183,
                    'created_at'    =>  now(),
                    'updated_at'    =>  now()
                ],
            ]);
        }
    }
public function run ( ) { if ( DB :: table ( 'item' ) -> count ( ) < 1 ) { DB :: table ( 'item' ) -> insert ( [ [ 'nama' => 'Mouse Logitech G566' , 'harga' => 150000 , 'stok' => 100 , 'created_at' => now ( ) , 'updated_at' => now ( ) ] , ] ) ; DB :: table ( 'item' ) -> insert ( [ [ 'nama' => 'Keyboard Logitech KL566' , 'harga' => 250000 , 'stok' => 1440 , 'created_at' => now ( ) , 'updated_at' => now ( ) ] , ] ) ; DB :: table ( 'item' ) -> insert ( [ [ 'nama' => 'Laptop Asus PV356' , 'harga' => 6599999 , 'stok' => 55 , 'created_at' => now ( ) , 'updated_at' => now ( ) ] , ] ) ; DB :: table ( 'item' ) -> insert ( [ [ 'nama' => 'Monitor LG G739' , 'harga' => 4500500 , 'stok' => 11 , 'created_at' => now ( ) , 'updated_at' => now ( ) ] , ] ) ; DB :: table ( 'item' ) -> insert ( [ [ 'nama' => 'Headset Razer PX34G5' , 'harga' => 230000 , 'stok' => 183 , 'created_at' => now ( ) , 'updated_at' => now ( ) ] , ] ) ; } }
Run the database seeds.
Run the database seeds .
//Tembak Data Di Database