Skip to content

Commit cbd1e55

Browse files
committed
Revert "Add community section (laravelio#614)"
This reverts commit 1d0a8f3.
1 parent 1d0a8f3 commit cbd1e55

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

app/Http/Controllers/Forum/TagsController.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use App\Models\Tag;
88
use App\Models\Thread;
99
use App\Models\User;
10-
use Illuminate\Support\Facades\Cache;
1110

1211
class TagsController extends Controller
1312
{
@@ -35,9 +34,7 @@ public function show(Tag $tag)
3534
}
3635

3736
$tags = Tag::orderBy('name')->get();
38-
$mostSolutions = Cache::remember('mostSolutions', now()->addDay(), function () {
39-
return User::mostSolutions()->take(5)->get();
40-
});
37+
$mostSolutions = User::mostSolutions()->take(3)->get();
4138

4239
return view('forum.overview', compact('threads', 'filter', 'tags', 'mostSolutions') + ['activeTag' => $tag]);
4340
}

app/Http/Controllers/Forum/ThreadsController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Illuminate\Auth\Middleware\Authenticate;
2121
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
2222
use Illuminate\Http\Request;
23-
use Illuminate\Support\Facades\Cache;
2423

2524
class ThreadsController extends Controller
2625
{
@@ -53,9 +52,8 @@ public function overview()
5352
}
5453

5554
$tags = Tag::orderBy('name')->get();
56-
$mostSolutions = Cache::remember('mostSolutions', now()->addDay(), function () {
57-
return User::mostSolutions()->take(5)->get();
58-
});
55+
$mostSolutions = [];
56+
// $mostSolutions = User::mostSolutions()->take(3)->get();
5957

6058
return view('forum.overview', compact('threads', 'filter', 'tags', 'mostSolutions'));
6159
}

app/Models/User.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Illuminate\Foundation\Auth\User as Authenticatable;
1212
use Illuminate\Notifications\Notifiable;
1313
use Illuminate\Support\Facades\Auth;
14-
use Illuminate\Support\Facades\DB;
1514

1615
final class User extends Authenticatable implements MustVerifyEmail
1716
{
@@ -254,10 +253,9 @@ public function countSolutions(): int
254253

255254
public function scopeMostSolutions(Builder $query)
256255
{
257-
return $query->select(DB::raw('users.*, count(*) as most_solutions'))
258-
->join('replies', 'replies.author_id', '=', 'users.id')
259-
->join('threads', 'threads.solution_reply_id', '=', 'replies.id')
260-
->groupBy('users.id')
261-
->orderBy('most_solutions', 'desc');
256+
return $query->withCount(['replyAble as most_solutions' => function ($query) {
257+
return $query->join('threads', 'threads.solution_reply_id', '=', 'replies.id')
258+
->where('replyable_type', 'threads');
259+
}])->orderBy('most_solutions', 'desc');
262260
}
263261
}

resources/views/forum/overview.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ class="{{ $filter === 'active' ? 'bg-lio-500' : 'bg-transparent'}} absolute inse
100100
<div class="sticky top-4 space-y-4">
101101
@include('layouts._ads._forum_sidebar')
102102

103-
<div class="mt-8 lg:mt-0 hidden lg:block">
104-
@include('forum._community_heroes')
105-
</div>
103+
{{-- <div class="mt-8 lg:mt-0 hidden lg:block">--}}
104+
{{-- @include('forum._community_heroes')--}}
105+
{{-- </div>--}}
106106

107107
<div class="mt-4 text-center">
108108
<a href="{{ route("feeds.forum") }}" class="inline-flex lg:flex items-center inline-block text-center px-6 py-3 border border-transparent shadow-sm text-base font-medium rounded-md text-white bg-lio-600 hover:bg-lio-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-lio-500">

0 commit comments

Comments
 (0)