<?php
namespace app\tbl;
use think\Model;
use traits\model\SoftDelete;
class Follower extends Model(){
use SoftDelete;
protected $deleteTime = 'delete_time';
...
}
// $rel = $department_mod->where('id',$id)->delete();
$department_mod = new model\Department();
$department = $department_mod->where('id',$id)->find();
$rel = $department->delete();
//注释掉的 是真实删除,要写成后来那种样子才是真正的软删除
如果要恢复软删除,要用update,用save是不行的,因为查询不到“已经被删除”了的数据
use think\Db;
...
Db::table($table_prefix.'follower')->where('openid', $openid)->->update(['delete_time' => ['exp', 'null']]);
...