<?php

use App\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class UsersTableSeeder extends Seeder
{
    protected $namesExamples = [
        'Aspect', 'Kraken', 'Bender', 'Lynch', 'BigPapa', 'MadDog',
        'Bowser', 'Bruise', 'Psycho', 'Cannon', 'Ranger', 'Clink',
        'Ratchet', 'Cobra', 'Reaper', 'Colt', 'Rigs', 'Crank',
        'Ripley', 'Creep', 'Roadkill', 'Daemon', 'Ronin', 'Decay',
        'Rubble', 'Diablo', 'Sasquatch', 'Doom', 'Scar', 'Dracula',
        'Shiver', 'Dragon', 'Skinner', 'Fender', 'SkullCrusher',
        'Fester', 'Slasher', 'Fisheye', 'Steelshot', 'Flack', 'Surge',
        'Gargoyle', 'Sythe', 'Grave', 'Trip', 'Gunner', 'Trooper',
        'Hash', 'Tweek', 'Hashtag', 'Vein', 'Indominus', 'Void',
        'Ironclad', 'Wardon', 'Killer', 'Wraith', 'Knuckles', 'Zero'
    ];


    public function run()
    {
        $userCount = 35;
        $result = [];
        foreach (DB::table('users')->get(['nickname']) as $value){
            $result[] = $value->nickname;
        }
        $newUsers = array_slice(array_diff($this->namesExamples, $result),0,$userCount);
        foreach ($newUsers as $nick) {
            User::create([
                'nickname' => $nick,
                'email' => $nick . rand(0, 2017) . '@gmail.com',
                'password' => bcrypt('password')
            ]);
        }
    }
}
