zbw / model
model
v1.0.0
2022-12-15 08:57 UTC
This package is auto-updated.
Last update: 2024-09-15 12:43:44 UTC
README
介绍
tp6 使用
- 引入:composer require zbw/model dev-master
使用:
- 配置好数据库链接的 env 环境
- 运行:php think zbw:model 表名(不带前缀) 如: php think zbw:model admin
将在 app 目录下创建 common 目录,创建 dao, model, repository 层
代码使用:
在app -> controller -> index.php 中的 :
文件头部引入:use app\common\repositories\AdminRepository;
index 方法:
public function index()
{
$arr = app()->make(AdminRepository::class)->lst([], 1, 10);
foreach ($arr['list'] as $key => $value) {
dump($value->admin_nickname);
// $value->admin_nickname = $value->admin_nickname.'_cs';
// $value->save();
}
exit();
}