xihrni/yii2-behavior-time
Composer 安装命令:
composer require xihrni/yii2-behavior-time
包简介
For automatic updating of database table creation, update, and delete fields in the model.
关键字:
README 文档
README
Introduction
用于自动更新模型中数据库表的创建、更新和删除字段
Install
$ composer require xihrni/yii2-behavior-time
Demo
CREATE TABLE `xi_article` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL DEFAULT '', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
<?php namespace app\models; use xihrni\yii2\behaviors\TimeBehavior; class Article extends \yii\db\ActiveRecord { public static function tableName() { return '{{%article}}'; } public function behaviors() { return array_merge(parent::behaviors(), [ 'time' => [ 'class' => TimeBehavior::className(), ], ]); } }
统计信息
- 总下载量: 34
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-05-05