<?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(), ]); } } }