mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Fix used groupBy query builder function syntax
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2017-12-26 DariusIII
|
||||
* Fix: Fix used groupBy query builder function syntax
|
||||
* Chg: Change order of query parts in processNfoFiles function
|
||||
* Chg: Use collection count method to get query rows count
|
||||
* Chg: Remove unused use statement for Users class
|
||||
|
||||
+2
-2
@@ -390,7 +390,7 @@ class User extends Authenticatable
|
||||
|
||||
$order = getUserBrowseOrder($orderBy);
|
||||
|
||||
$users = self::query()->with('role', 'request')->where('id', '!=', 0)->groupBy(['id'])->orderBy($order[0], $order[1])->withCount('request as apirequests');
|
||||
$users = self::query()->with('role', 'request')->where('id', '!=', 0)->groupBy('id')->orderBy($order[0], $order[1])->withCount('request as apirequests');
|
||||
if ($userName !== '') {
|
||||
$users->where('username', 'LIKE', '%'.$userName.'%');
|
||||
}
|
||||
@@ -865,7 +865,7 @@ class User extends Authenticatable
|
||||
*/
|
||||
public static function getTopGrabbers()
|
||||
{
|
||||
return self::query()->selectRaw('id, username, SUM(grabs) as grabs')->groupBy(['id', 'username'])->having('grabs', '>', 0)->orderBy('grabs', 'desc')->limit(10)->get();
|
||||
return self::query()->selectRaw('id, username, SUM(grabs) as grabs')->groupBy('id', 'username')->having('grabs', '>', 0)->orderBy('grabs', 'desc')->limit(10)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,7 @@ class UserRole extends Model
|
||||
*/
|
||||
public static function getUsersByRole()
|
||||
{
|
||||
return self::query()->select(['name'])->withCount('users')->groupBy(['name'])->having('users_count', '>', 0)->orderBy('users_count', 'desc')->get();
|
||||
return self::query()->select(['name'])->withCount('users')->groupBy('name')->having('users_count', '>', 0)->orderBy('users_count', 'desc')->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ class Groups
|
||||
*/
|
||||
public function getRange($offset = false, $limit = false, $groupname = '', $active = false)
|
||||
{
|
||||
$groups = Group::query()->groupBy(['id'])->orderBy('name');
|
||||
$groups = Group::query()->groupBy('id')->orderBy('name');
|
||||
|
||||
if ($groupname !== '') {
|
||||
$groups->where('name', 'LIKE', '%'.$groupname.'%');
|
||||
|
||||
+1
-1
@@ -302,7 +302,7 @@ class Nfo
|
||||
$qry = Release::query()
|
||||
->select(['nfostatus as status'])
|
||||
->selectRaw('COUNT(id) as count')
|
||||
->groupBy(['nfostatus'])
|
||||
->groupBy('nfostatus')
|
||||
->orderBy('nfostatus');
|
||||
|
||||
if ($guidChar !== '') {
|
||||
|
||||
+19
-3
@@ -1486,7 +1486,15 @@ class Releases
|
||||
return $releases;
|
||||
}
|
||||
|
||||
$releases = Release::query()->where('grabs', '>', 0)->select(['id', 'searchname', 'guid', 'adddate'])->selectRaw('SUM(grabs) as grabs')->groupBy(['id', 'searchname', 'adddate'])->havingRaw('SUM(grabs) > 0')->orderBy('grabs', 'desc')->limit(10)->get();
|
||||
$releases = Release::query()
|
||||
->where('grabs', '>', 0)
|
||||
->select(['id', 'searchname', 'guid', 'adddate'])
|
||||
->selectRaw('SUM(grabs) as grabs')
|
||||
->groupBy('id', 'searchname', 'adddate')
|
||||
->havingRaw('SUM(grabs) > 0')
|
||||
->orderBy('grabs', 'desc')
|
||||
->limit(10)
|
||||
->get();
|
||||
|
||||
$expiresAt = Carbon::now()->addSeconds(NN_CACHE_EXPIRY_LONG);
|
||||
Cache::put('topdownloads', $releases, $expiresAt);
|
||||
@@ -1504,7 +1512,15 @@ class Releases
|
||||
return $comments;
|
||||
}
|
||||
|
||||
$comments = Release::query()->where('comments', '>', 0)->select(['id', 'guid', 'searchname'])->selectRaw('SUM(comments) AS comments')->groupBy(['id', 'searchname', 'adddate'])->havingRaw('SUM(comments) > 0')->orderBy('comments', 'desc')->limit(10)->get();
|
||||
$comments = Release::query()
|
||||
->where('comments', '>', 0)
|
||||
->select(['id', 'guid', 'searchname'])
|
||||
->selectRaw('SUM(comments) AS comments')
|
||||
->groupBy('id', 'searchname', 'adddate')
|
||||
->havingRaw('SUM(comments) > 0')
|
||||
->orderBy('comments', 'desc')
|
||||
->limit(10)
|
||||
->get();
|
||||
$expiresAt = Carbon::now()->addSeconds(NN_CACHE_EXPIRY_LONG);
|
||||
Cache::put('topcomments', $comments, $expiresAt);
|
||||
|
||||
@@ -1527,7 +1543,7 @@ class Releases
|
||||
->selectRaw('COUNT(r.id) as count')
|
||||
->join('categories as cp', 'cp.id', '=', 'categories.parentid')
|
||||
->join('releases as r', 'r.categories_id', '=', 'categories.id')
|
||||
->groupBy(['title'])
|
||||
->groupBy('title')
|
||||
->orderBy('count', 'desc')
|
||||
->get();
|
||||
|
||||
|
||||
@@ -861,7 +861,7 @@ class Forking extends \fork_daemon
|
||||
$qry->where('size', '>', $this->minSize * 1048576);
|
||||
}
|
||||
|
||||
$this->work = $qry->groupBy(['leftguid'])->limit(16)->get()->toArray();
|
||||
$this->work = $qry->groupBy('leftguid')->limit(16)->get()->toArray();
|
||||
|
||||
$maxProcesses = (int) Settings::settingValue('..nfothreads');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user