/** * @param Models\Board $board * @return Models\Thread[] */ public function getThreads(Models\Board $board) { $threads = Models\Thread::search()->where('board_id', $board->board_id)->where('deleted', 'No')->exec(); return $threads; }
/** * @param Models\Board $board * @return Models\Board */ public function calculateThreadCounts(Models\Board $board) { $board->thread_count = Models\Thread::search()->where("board_id", $board->board_id)->where('deleted', 'No')->count(); $board->save(); return $board; }