mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Group management code.
This commit is contained in:
@@ -505,6 +505,30 @@ class FireflyValidator extends Validator
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validateUniqueObjectGroup($attribute, $value, $parameters): bool
|
||||
{
|
||||
$exclude = $parameters[0] ?? null;
|
||||
$query = DB::table('object_groups')
|
||||
->whereNull('object_groups.deleted_at')
|
||||
->where('object_groups.user_id', auth()->user()->id)
|
||||
->where('object_groups.title', $value);
|
||||
if (null !== $exclude) {
|
||||
$query->where('object_groups.id', '!=', (int) $exclude);
|
||||
}
|
||||
|
||||
return 0 === $query->count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $attribute
|
||||
* @param $value
|
||||
* @param $parameters
|
||||
*
|
||||
* TODO this method does not need a for loop
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validateUniquePiggyBankForUser($attribute, $value, $parameters): bool
|
||||
{
|
||||
$exclude = $parameters[0] ?? null;
|
||||
|
Reference in New Issue
Block a user