setTimestamp($last_minute_unix); $user = UserHelper::getUserByUsername($username); $links_last_minute = Link::where('is_api', 1) ->where('creator', $username) ->where('created_at', '>=', $last_minute) ->count(); return ($user->api_quota > -1 && $links_last_minute >= $user->api_quota); } }