32 lines
692 B
PHP
32 lines
692 B
PHP
<?php
|
|
|
|
use App\User;
|
|
use App\UserRole;
|
|
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' => 'comi',
|
|
'password' => Hash::make("123"),
|
|
'role_id' => UserRole::where('nombre', 'comision')->first()->id,
|
|
'is_admin' => 0,
|
|
'is_compras' => 1
|
|
];
|
|
|
|
|
|
foreach (array_chunk($usersToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk)
|
|
User::insert($chunk);
|
|
}
|
|
}
|