public static function getThreadInfo($sort = '', $order = '') { //ソートの種類によってデータベースアクセス方法を分岐 switch ($sort) { case 'thread': $threads = ThreadView::select('id', 'amount', 'thread', 'user')->orderBy('created_at', $order)->get(); break; case 'user': $threads = ThreadView::select('id', 'amount', 'thread', 'user')->orderBy($sort, $order)->get(); break; case 'amount': $threads = ThreadView::select('id', 'amount', 'thread', 'user')->orderBy($sort, $order)->get(); break; default: $threads = ThreadView::all(); } return $threads; }