Intention.php 612 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\admin\model;
  3. use think\Db;
  4. use think\Model;
  5. class Intention extends Model
  6. {
  7. // 表名
  8. protected $table = 'intention';
  9. // 自动写入时间戳字段
  10. protected $autoWriteTimestamp = false;
  11. // 追加属性
  12. protected $append = [
  13. ];
  14. /**
  15. * 增加新的单位性质
  16. */
  17. public static function addUnitType($name)
  18. {
  19. $res = Db::table('unit_type')
  20. ->where('name',$name)
  21. ->find();
  22. if(!$res){
  23. Db::table('unit_type')->insert(['name'=>$name]);
  24. }
  25. }
  26. }