where('id', $id)->whereNull('deleted_at')->first(); $info->makeHidden(['updated_at', 'deleted_at']); $info = !empty($info) ? $info->toArray() : []; return $info; } //通过手机号查用户 public static function checkUserByMobile($mobile) { $user = User::where('mobile', $mobile)->whereNull('deleted_at')->first(); if ($user) { return true; } return false; } //通过邮箱查找用户 public static function checkUserByEmail($email) { $user = User::where('email', $email)->whereNull('deleted_at')->first(); if ($user) { return true; } return false; } //收藏数+1 public static function collectNumInc($userId) { User::query()->where('id', $userId)->increment('collect_num'); } //收藏数-1 public static function collectNumDec($userId) { User::query()->where('id', $userId)->decrement('collect_num'); } }