mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-23 03:34:22 -05:00
update: forums
Co-Authored-By: Roardom <78790963+Roardom@users.noreply.github.com>
This commit is contained in:
@@ -16,6 +16,7 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Forum;
|
||||
use App\Models\Post;
|
||||
use App\Models\Topic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* @see \Tests\Todo\Feature\Http\Controllers\Staff\ForumControllerTest
|
||||
@@ -25,14 +26,16 @@ class ForumController extends Controller
|
||||
/**
|
||||
* Show All Forums.
|
||||
*/
|
||||
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
public function index(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
$categories = Forum::query()
|
||||
->with(['forums' => fn ($query) => $query
|
||||
->whereRelation('permissions', [['show_forum', '=', 1], ['group_id', '=', auth()->user()->group_id]])
|
||||
->whereRelation('permissions', [['show_forum', '=', 1], ['group_id', '=', $user->group_id]])
|
||||
])
|
||||
->where('parent_id', '=', 0)
|
||||
->whereRelation('permissions', [['show_forum', '=', 1], ['group_id', '=', auth()->user()->group_id]])
|
||||
->whereRelation('permissions', [['show_forum', '=', 1], ['group_id', '=', $user->group_id]])
|
||||
->orderBy('position')
|
||||
->get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user