use think\model\concern\SoftDelete; /** * @mixin \think\Model */ class mode extends Model { protected $table=''; //数据表删除记录字段 protected $delete_time='delete_time'; //引入软删除 use SoftDelete; //软删除删除数据 public function Soft_delete($id) { return $this->destroy($id); } //回收站数据查询 public function recycle_bin() { return $this->onlyTrashed()->paginate(5); } //恢复回收站删除数据 public function resume_delete_data($id) { $user = mode::onlyTrashed()->find($id); return $user->restore(); } }
thinkphp6 模型 软删除&回收站
于 2022-04-26 20:46:22 首次发布