Skip to content

Commit

Permalink
update backend
Browse files Browse the repository at this point in the history
  • Loading branch information
xlcrr committed Jul 23, 2023
1 parent dd9bade commit 391a07d
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions app/Http/Controllers/API/DeleteAccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,26 +223,25 @@ public function __invoke (Request $request)
$modelHasRoles = DB::table('model_has_roles')
->where('model_type', 'App\Models\User\User')
->where('model_id', $userId)
->get();
->count();

if (sizeof($modelHasRoles) > 0)
if ($modelHasRoles > 0)
{
foreach ($modelHasRoles as $modelHasRole)
{
$modelHasRole->delete();
}
DB::table('model_has_roles')
->where('model_type', 'App\Models\User\User')
->where('model_id', $userId)
->delete();
}

$oauthTokens = DB::table('oauth_access_tokens')
->where('user_id', $userId)
->get();
->count();

if (sizeof($oauthTokens) > 0)
if ($oauthTokens > 0)
{
foreach ($oauthTokens as $oauthToken)
{
$oauthToken->delete();
}
DB::table('oauth_access_tokens')
->where('user_id', $userId)
->delete();
}

// payments
Expand All @@ -262,24 +261,25 @@ public function __invoke (Request $request)
// subscriptions
$subscriptions = DB::table('subscriptions')
->where('user_id', $userId)
->get();
->count();

if (sizeof($subscriptions) > 0 )
if ($subscriptions > 0 )
{
foreach ($subscriptions as $subscription)
{
$subscription->delete();
}
DB::table('subscriptions')
->where('user_id', $userId)
->delete();
}

// team_user
$teamUsers = DB::table('team_user')
->where('user_id', $userId)
->get();
->count();

foreach ($teamUsers as $teamUser)
if ($teamUsers > 0)
{
$teamUser->delete();
DB::table('team_user')
->where('user_id', $userId)
->delete();
}

$teams = Team::where('leader', $userId)
Expand Down

0 comments on commit 391a07d

Please sign in to comment.