public function latestThreads($page, $board) { $count = Thread::count(); $threads = Thread::skip(($page - 1) * 15)->take(15)->orderBy('id', 'desc'); if ($board != 'all') { $threads->where('board', '=', $board); } return response()->json(['total_rows' => $count, 'threads' => $threads->get()]); }