Update AdminController, update reports method

This commit is contained in:
Daniel Supernault 2021-02-15 21:07:18 -07:00
parent a70ab1ba36
commit 2ab73e1e96
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -67,7 +67,10 @@ class AdminController extends Controller
public function reports(Request $request)
{
$filter = $request->input('filter') == 'closed' ? 'closed' : 'open';
$reports = Report::orderBy('created_at','desc')
$reports = Report::whereHas('status')
->whereHas('reportedUser')
->whereHas('reporter')
->orderBy('created_at','desc')
->when($filter, function($q, $filter) {
return $filter == 'open' ?
$q->whereNull('admin_seen') :