Questions: Show newest first

This commit is contained in:
Igor Scheller 2020-11-29 20:00:15 +01:00
parent 39f96783cf
commit 507e94aa55
2 changed files with 10 additions and 4 deletions

View File

@ -42,7 +42,7 @@ function admin_questions()
if (!$request->has('action')) { if (!$request->has('action')) {
$unanswered_questions_table = []; $unanswered_questions_table = [];
$unanswered_questions = Question::unanswered()->get(); $unanswered_questions = Question::unanswered()->orderByDesc('created_at')->get();
foreach ($unanswered_questions as $question) { foreach ($unanswered_questions as $question) {
/* @var Question $question */ /* @var Question $question */
@ -63,7 +63,7 @@ function admin_questions()
} }
$answered_questions_table = []; $answered_questions_table = [];
$answered_questions = Question::answered()->get(); $answered_questions = Question::answered()->orderByDesc('answered_at')->get();
foreach ($answered_questions as $question) { foreach ($answered_questions as $question) {
/* @var Question $question */ /* @var Question $question */

View File

@ -19,8 +19,14 @@ function user_questions()
$request = request(); $request = request();
if (!$request->has('action')) { if (!$request->has('action')) {
$open_questions = $user->questionsAsked()->whereNull('answerer_id')->get(); $open_questions = $user->questionsAsked()
$answered_questions = $user->questionsAsked()->whereNotNull('answerer_id')->get(); ->whereNull('answerer_id')
->orderByDesc('created_at')
->get();
$answered_questions = $user->questionsAsked()
->whereNotNull('answerer_id')
->orderByDesc('answered_at')
->get();
return Questions_view( return Questions_view(
$open_questions->all(), $open_questions->all(),