This commit is contained in:
wuyanwen
2019-12-11 21:00:27 +08:00
4 changed files with 96 additions and 19 deletions

View File

@@ -5,6 +5,7 @@ use catcher\command\InstallCommand;
use catcher\command\MigrateRunCommand;
use catcher\command\ModelGeneratorCommand;
use catcher\command\ModuleCacheCommand;
use catcher\command\SeedRunCommand;
use catcher\validates\Sometimes;
use think\facade\Validate;
use think\Service;
@@ -23,6 +24,7 @@ class CatchAdminService extends Service
ModuleCacheCommand::class,
MigrateRunCommand::class,
ModelGeneratorCommand::class,
SeedRunCommand::class
]);
$this->registerValidates();

View File

@@ -1,19 +0,0 @@
<?php
use think\migration\Seeder;
class Abc 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()
{
}
}

View File

@@ -0,0 +1,30 @@
<?php
use think\migration\Seeder;
class UserSeeder 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()
{
$row = [
'username' => 'wuyanwen',
'password' => password_hash('password',PASSWORD_DEFAULT),
'email' => 'njphper@gmail.com',
'status' => 1,
'last_login_ip' => ip2long('127.0.0.1'),
'last_login_time' => time(),
'created_at' => time(),
'updated_at' => time(),
'deleted_at' => '',
];
$this->table('users')->insert($row)->save();
}
}