mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Various code cleanup.
This commit is contained in:
@@ -253,12 +253,10 @@ class UserRepository implements UserRepositoryInterface
|
||||
->where('amount', '>', 0)
|
||||
->whereNull('budgets.deleted_at')
|
||||
->where('budgets.user_id', $user->id)
|
||||
->get(['budget_limits.budget_id'])
|
||||
->count();
|
||||
->count('budget_limits.budget_id');
|
||||
$return['rule_groups'] = $user->ruleGroups()->count();
|
||||
$return['rules'] = $user->rules()->count();
|
||||
$return['tags'] = $user->tags()->count();
|
||||
var_dump($return);exit;
|
||||
|
||||
return $return;
|
||||
}
|
||||
@@ -338,7 +336,7 @@ class UserRepository implements UserRepositoryInterface
|
||||
*/
|
||||
public function unblockUser(User $user): void
|
||||
{
|
||||
$user->blocked = 0;
|
||||
$user->blocked = false;
|
||||
$user->blocked_code = '';
|
||||
$user->save();
|
||||
|
||||
@@ -355,13 +353,13 @@ class UserRepository implements UserRepositoryInterface
|
||||
public function update(User $user, array $data): User
|
||||
{
|
||||
$this->updateEmail($user, $data['email'] ?? '');
|
||||
if (isset($data['blocked']) && is_bool($data['blocked'])) {
|
||||
if (array_key_exists('blocked', $data) && is_bool($data['blocked'])) {
|
||||
$user->blocked = $data['blocked'];
|
||||
}
|
||||
if (isset($data['blocked_code']) && '' !== $data['blocked_code'] && is_string($data['blocked_code'])) {
|
||||
if (array_key_exists('blocked_code', $data) && '' !== $data['blocked_code'] && is_string($data['blocked_code'])) {
|
||||
$user->blocked_code = $data['blocked_code'];
|
||||
}
|
||||
if (isset($data['role']) && '' === $data['role']) {
|
||||
if (array_key_exists('role', $data) && '' === $data['role']) {
|
||||
$this->removeRole($user, 'owner');
|
||||
$this->removeRole($user, 'demo');
|
||||
}
|
||||
|
Reference in New Issue
Block a user