AuthRule.php 701 B

12345678910111213141516171819202122232425262728293031323334
  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. public function getMenutypeList()
  23. {
  24. return ['addtabs' => __('Addtabs'), 'dialog' => __('Dialog'), 'ajax' => __('Ajax'), 'blank' => __('Blank')];
  25. }
  26. }