forked from mirror/pixelfed
Update AdminMediaController, improve perf and use simple pagination
This commit is contained in:
parent
4a30ff118d
commit
f2686cacd2
1 changed files with 4 additions and 2 deletions
|
@ -27,6 +27,7 @@ trait AdminMediaController
|
||||||
],
|
],
|
||||||
'search' => 'nullable|string|min:1|max:20'
|
'search' => 'nullable|string|min:1|max:20'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if($request->filled('search')) {
|
if($request->filled('search')) {
|
||||||
$profiles = Profile::where('username', 'like', '%'.$request->input('search').'%')->pluck('id')->toArray();
|
$profiles = Profile::where('username', 'like', '%'.$request->input('search').'%')->pluck('id')->toArray();
|
||||||
$media = Media::whereHas('status')
|
$media = Media::whereHas('status')
|
||||||
|
@ -42,7 +43,8 @@ trait AdminMediaController
|
||||||
$media = MediaBlocklist::latest()->paginate(12);
|
$media = MediaBlocklist::latest()->paginate(12);
|
||||||
return view('admin.media.home', compact('media'));
|
return view('admin.media.home', compact('media'));
|
||||||
}
|
}
|
||||||
$media = Media::whereHas('status')->with('status')->orderby('id', 'desc')->paginate(12);
|
|
||||||
|
$media = Media::whereNull('remote_url')->orderby('id', 'desc')->simplePaginate(12);
|
||||||
return view('admin.media.home', compact('media'));
|
return view('admin.media.home', compact('media'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,4 +53,4 @@ trait AdminMediaController
|
||||||
$media = Media::findOrFail($id);
|
$media = Media::findOrFail($id);
|
||||||
return view('admin.media.show', compact('media'));
|
return view('admin.media.show', compact('media'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue