Files
mayi-grade/database/seeds/Teacher.php
T
2021-01-08 11:41:27 +08:00

42 lines
1.0 KiB
PHP

<?php
use think\migration\Seeder;
class Teacher extends Seeder
{
/**
* Run Method.
*
* Write your database seeder using this method.
*
* More information on writing seeders is available here:
* http://docs.phinx.org/en/latest/seeding.html
*/
public function run()
{
// 设置数据
$rows= [
[
'xingming' => '嬴政'
,'sex' => 1
,'shengri' => 533491200
,'worktime' => 1188144000
,'danwei_id' =>2
,'quanpin' => 'yingzheng'
,'shoupin' => 'yz'
,'phone' => 13190180000
,'password' => '$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1'
]
];
$serRows = $this->fetchAll('select * from cj_teacher');
if(is_array($serRows) && count($serRows) > 0)
{
$rows = [];
return true;
}
// 保存数据
$this->table('teacher')->insert($rows)->save();
}
}