Merge pull request 'funcion/migracion-de-usuarios' (#42) from funcion/migracion-de-usuarios into master
Reviewed-on: #42
This commit is contained in:
		
						commit
						70bbaad3c7
					
				
					 4 changed files with 4525 additions and 3345 deletions
				
			
		| 
						 | 
				
			
			@ -14,5 +14,6 @@ class DatabaseSeeder extends Seeder
 | 
			
		|||
    {
 | 
			
		||||
        $this->call(CanastaSeeder::class);
 | 
			
		||||
        $this->call(GrupoDeCompraSeeder::class);
 | 
			
		||||
        $this->call(UserSeeder::class);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,8 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
use Illuminate\Database\Seeder;
 | 
			
		||||
use Illuminate\Support\Facades\DB;
 | 
			
		||||
use Illuminate\Support\Facades\Hash;
 | 
			
		||||
use League\Csv\Reader;
 | 
			
		||||
 | 
			
		||||
class GrupoDeCompraSeeder extends Seeder
 | 
			
		||||
| 
						 | 
				
			
			@ -31,14 +33,14 @@ class GrupoDeCompraSeeder extends Seeder
 | 
			
		|||
 | 
			
		||||
            $usersToInsert[] = [
 | 
			
		||||
                'name' => $registro['barrio'],
 | 
			
		||||
                'password' => Hash::make("asd"),
 | 
			
		||||
                'password' => Hash::make("123"),
 | 
			
		||||
                "is_admin" => 0,
 | 
			
		||||
                'grupo_de_compra_id' => $key
 | 
			
		||||
            ];
 | 
			
		||||
 | 
			
		||||
            $usersToInsert[] = [
 | 
			
		||||
                'name' => $registro['barrio'] . "_admin",
 | 
			
		||||
                'password' => Hash::make("asd"),
 | 
			
		||||
                'password' => Hash::make("123"),
 | 
			
		||||
                "is_admin" => 1,
 | 
			
		||||
                'grupo_de_compra_id' => $key
 | 
			
		||||
            ];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										31
									
								
								database/seeds/UserSeeder.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								database/seeds/UserSeeder.php
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
use Illuminate\Database\Seeder;
 | 
			
		||||
use Illuminate\Support\Facades\DB;
 | 
			
		||||
use Illuminate\Support\Facades\Hash;
 | 
			
		||||
 | 
			
		||||
class UserSeeder extends Seeder
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the database seeds.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function run()
 | 
			
		||||
    {
 | 
			
		||||
        $usersToInsert = [];
 | 
			
		||||
 | 
			
		||||
        $usersToInsert[] = [
 | 
			
		||||
            'name' => 'compras',
 | 
			
		||||
            'password' => Hash::make("123"),
 | 
			
		||||
            'is_admin' => 0,
 | 
			
		||||
            'is_compras' => 1
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        foreach (array_chunk($usersToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk)
 | 
			
		||||
        {
 | 
			
		||||
            DB::table('users')->insert($chunk);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7832
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										7832
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
	Add table
		
		Reference in a new issue