forked from nathalie/pedi2
Agregado UserSeeder para usuario de compras
This commit is contained in:
parent
b5f37c9de9
commit
31bc076989
2 changed files with 32 additions and 0 deletions
|
@ -14,5 +14,6 @@ class DatabaseSeeder extends Seeder
|
|||
{
|
||||
$this->call(CanastaSeeder::class);
|
||||
$this->call(GrupoDeCompraSeeder::class);
|
||||
$this->call(UserSeeder::class);
|
||||
}
|
||||
}
|
||||
|
|
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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue