AuthRule.php 533 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\admin\model;
  3. use think\Cache;
  4. use think\Model;
  5. class AuthRule extends Model
  6. {
  7. // 开启自动写入时间戳字段
  8. protected $autoWriteTimestamp = 'int';
  9. // 定义时间戳字段名
  10. protected $createTime = 'createtime';
  11. protected $updateTime = 'updatetime';
  12. protected static function init()
  13. {
  14. self::afterWrite(function ($row) {
  15. Cache::rm('__menu__');
  16. });
  17. }
  18. public function getTitleAttr($value, $data)
  19. {
  20. return __($value);
  21. }
  22. }