refactor: dynamic calls to static

This commit is contained in:
HDVinnie
2021-04-27 21:35:23 -04:00
parent 4fe76bcc10
commit 71ff333eb4
5 changed files with 15 additions and 15 deletions
@@ -360,7 +360,7 @@ class TorrentController extends BaseController
$description .= '%'.$keyword.'%';
}
$torrent = $torrent->newQuery();
$torrent = $torrent::newQuery();
if ($request->has('name') && $request->input('name') != null) {
$torrent->where(function ($query) use ($search) {
+1 -1
View File
@@ -86,7 +86,7 @@ class GraveyardController extends Controller
$search .= '%'.$term.'%';
}
$torrent = $torrent->with('category', 'type')->where('seeders', '=', 0)->where('created_at', '<', $current->copy()->subDays(30)->toDateTimeString());
$torrent = $torrent::with('category', 'type')->where('seeders', '=', 0)->where('created_at', '<', $current->copy()->subDays(30)->toDateTimeString());
if ($request->has('search') && $request->input('search') != null) {
$torrent->where('name', 'like', $search);
+2 -2
View File
@@ -564,7 +564,7 @@ class TorrentController extends Controller
if (! $history || ! \is_array($history)) {
$history = [];
}
$torrent = $torrent->with(['user:id,username,group_id', 'category', 'type', 'resolution'])->withCount(['thanks', 'comments'])->whereNotIn('torrents.id', $history);
$torrent = $torrent::with(['user:id,username,group_id', 'category', 'type', 'resolution'])->withCount(['thanks', 'comments'])->whereNotIn('torrents.id', $history);
} elseif ($history == 1) {
$torrent = History::where('history.user_id', '=', $user->id);
$torrent->where(function ($query) use ($seedling, $downloaded, $leeching, $idling) {
@@ -593,7 +593,7 @@ class TorrentController extends Controller
$join->on('history.info_hash', '=', 'torrents.info_hash');
})->groupBy('torrents.id');
} else {
$torrent = $torrent->with(['user:id,username,group_id', 'category', 'type', 'resolution'])->withCount(['thanks', 'comments']);
$torrent = $torrent::with(['user:id,username,group_id', 'category', 'type', 'resolution'])->withCount(['thanks', 'comments']);
}
if ($collection != 1) {
if ($request->has('search') && $request->input('search') != null) {
+10 -10
View File
@@ -51,12 +51,12 @@ class ChatRepository
public function bots()
{
return $this->bot->all();
return $this->bot::all();
}
public function echoes($userId)
{
return $this->userEcho->with([
return $this->userEcho::with([
'bot',
'user',
'target',
@@ -70,7 +70,7 @@ class ChatRepository
public function audibles($userId)
{
return $this->userAudible->with([
return $this->userAudible::with([
'bot',
'user',
'target',
@@ -84,7 +84,7 @@ class ChatRepository
public function rooms()
{
return $this->chatroom->all();
return $this->chatroom::all();
}
public function roomFindOrFail($id)
@@ -202,7 +202,7 @@ class ChatRepository
public function messages($roomId)
{
return $this->message->with([
return $this->message::with([
'bot',
'user.group',
'chatroom',
@@ -221,7 +221,7 @@ class ChatRepository
{
$systemUserId = User::where('username', 'System')->firstOrFail()->id;
return $this->message->with([
return $this->message::with([
'bot',
'user.group',
'chatroom',
@@ -238,7 +238,7 @@ class ChatRepository
public function privateMessages($senderId, $targetId)
{
return $this->message->with([
return $this->message::with([
'bot',
'user.group',
'chatroom',
@@ -299,14 +299,14 @@ class ChatRepository
} elseif (\is_int($room)) {
$room = $this->chatroom->findOrFail($room)->id;
} else {
$room = $this->chatroom->whereName($room)->first()->id;
$room = $this->chatroom::whereName($room)->first()->id;
}
} elseif (\is_int($config)) {
$room = $this->chatroom->findOrFail($config)->id;
} elseif ($config instanceof Chatroom) {
$room = $config->id;
} else {
$room = $this->chatroom->whereName($config)->first()->id;
$room = $this->chatroom::whereName($config)->first()->id;
}
return $room;
@@ -314,7 +314,7 @@ class ChatRepository
public function statuses()
{
return $this->chatStatus->all();
return $this->chatStatus::all();
}
public function status($user)
+1 -1
View File
@@ -38,7 +38,7 @@ class WishRepository implements WishInterface
*/
public function all($paginate = null)
{
return $paginate ? $this->wish->paginate($paginate) : $this->wish->all();
return $paginate ? $this->wish->paginate($paginate) : $this->wish::all();
}
/**