Questions: Show newest first

main
Igor Scheller 4 years ago
parent 39f96783cf
commit 507e94aa55

@ -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 */

@ -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(),

Loading…
Cancel
Save