DeviceSeeder.php 1.36 KB
Newer Older
Administrator's avatar
Administrator committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Ramsey\Uuid\Uuid;

class DeviceSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        for ($i= 0; $i < 100; $i++) {
            $dtype = random_int(1, 11);
            if($dtype === 3) $dtype = 2;
            DB::table('device')->insert([
                'uid' => 1,
                'contactsid' => random_int(1, 7),
                'devicenum' => Str::random(22),
                'dtype' => $dtype,
                'status' => 1,
                'devicemonad' => random_int(1, 8),
                'devicepolice' => random_int(1, 8),
                'deviceuuid' => Uuid::uuid1()->toString(),
                'username' => "河北泽宏" . random_int(1, 1000) . "号测试设备",
                'nd' => random_int(0, 1000),
                'deviceremark' => '河北泽宏' . $i,
                'devicelinkman' => Str::random(10),
                'devicephone' => '1883011' . random_int(1000, 9999),
                'deviceinfo' => Str::random(10),
                'devicecoord' => '114.'. random_int(100000, 999999) .',38.'. random_int(100000, 999999),
                'deviceaddtime' => time(),
                'update_time' => time(),
        ]);
        }
    }
}