Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions app/Helpers/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,17 @@ function hasLimits($object) {
* Checks if a user has a limit unlocked.
*
* @param mixed $object
* @param mixed $user
*/
function hasUnlockedLimits($object) {
$service = new App\Services\LimitManager;
function hasUnlockedLimits($user, $object) {
if (!hasLimits($object)) {
return true;
}

return $service->checkLimits($object);
return App\Models\Limit\UserUnlockedLimit::where('user_id', $user->id)
->where('object_model', get_class($object))
->where('object_id', $object->id)
->exists();
}

/**
Expand Down