mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-23 19:50:40 -05:00
update: UNIT3D linting
- github action updated with new ruleset in pint.json - codebase linted with new ruleset - contributors can now run `./vendor/bin/pint` - action workflow will auto correct any lint issues upon commit/opened pull request
This commit is contained in:
@@ -34,17 +34,17 @@ class ForumController extends Controller
|
||||
$user = $request->user();
|
||||
|
||||
$pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray();
|
||||
if (! \is_array($pests)) {
|
||||
if ( ! \is_array($pests)) {
|
||||
$pests = [];
|
||||
}
|
||||
|
||||
$topicNeos = $user->subscriptions->where('topic_id', '>', 0)->pluck('topic_id')->toArray();
|
||||
if (! \is_array($topicNeos)) {
|
||||
if ( ! \is_array($topicNeos)) {
|
||||
$topicNeos = [];
|
||||
}
|
||||
|
||||
$forumNeos = $user->subscriptions->where('forum_id', '>', 0)->pluck('forum_id')->toArray();
|
||||
if (! \is_array($forumNeos)) {
|
||||
if ( ! \is_array($forumNeos)) {
|
||||
$forumNeos = [];
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class ForumController extends Controller
|
||||
$result = Post::selectRaw('posts.id as id,posts.*')->with(['topic', 'user'])->leftJoin('topics', 'posts.topic_id', '=', 'topics.id')->whereIntegerNotInRaw('topics.forum_id', $pests);
|
||||
}
|
||||
|
||||
if (! isset($logger)) {
|
||||
if ( ! isset($logger)) {
|
||||
$logger = 'forum.results_topics';
|
||||
$result = Topic::whereIntegerNotInRaw('topics.forum_id', $pests);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ class ForumController extends Controller
|
||||
}
|
||||
|
||||
if ($request->has('subscribed') && $request->input('subscribed') == 1) {
|
||||
$result->where(function ($query) use ($topicNeos, $forumNeos) {
|
||||
$result->where(function ($query) use ($topicNeos, $forumNeos): void {
|
||||
$query->whereIntegerInRaw('topics.id', $topicNeos)->orWhereIntegerInRaw('topics.forum_id', $forumNeos);
|
||||
});
|
||||
} elseif ($request->has('notsubscribed') && $request->input('notsubscribed') == 1) {
|
||||
@@ -115,7 +115,7 @@ class ForumController extends Controller
|
||||
if ($category > 0 && $category < 99_999_999_999) {
|
||||
$children = Forum::where('parent_id', '=', $category)->get()->toArray();
|
||||
if (\is_array($children)) {
|
||||
$result->where(function ($query) use ($category, $children) {
|
||||
$result->where(function ($query) use ($category, $children): void {
|
||||
$query->where('topics.forum_id', '=', $category)->orWhereIn('topics.forum_id', $children);
|
||||
});
|
||||
}
|
||||
@@ -124,14 +124,14 @@ class ForumController extends Controller
|
||||
|
||||
if ($request->has('body') && $request->input('body') != '') {
|
||||
if ($request->has('sorting') && $request->input('sorting') != null) {
|
||||
$sorting = \sprintf('posts.%s', $request->input('sorting'));
|
||||
$sorting = sprintf('posts.%s', $request->input('sorting'));
|
||||
$direction = $request->input('direction');
|
||||
} else {
|
||||
$sorting = 'posts.id';
|
||||
$direction = 'desc';
|
||||
}
|
||||
} elseif ($request->has('sorting') && $request->input('sorting') != null) {
|
||||
$sorting = \sprintf('topics.%s', $request->input('sorting'));
|
||||
$sorting = sprintf('topics.%s', $request->input('sorting'));
|
||||
$direction = $request->input('direction');
|
||||
} else {
|
||||
$sorting = 'topics.last_reply_at';
|
||||
@@ -148,7 +148,7 @@ class ForumController extends Controller
|
||||
|
||||
$params = $request->all();
|
||||
|
||||
return \view($logger, [
|
||||
return view($logger, [
|
||||
'categories' => $categories,
|
||||
'results' => $results,
|
||||
'user' => $user,
|
||||
@@ -169,21 +169,21 @@ class ForumController extends Controller
|
||||
$user = $request->user();
|
||||
|
||||
$pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray();
|
||||
if (! \is_array($pests)) {
|
||||
if ( ! \is_array($pests)) {
|
||||
$pests = [];
|
||||
}
|
||||
|
||||
$topicNeos = $user->subscriptions->where('topic_id', '>', '0')->pluck('topic_id')->toArray();
|
||||
if (! \is_array($topicNeos)) {
|
||||
if ( ! \is_array($topicNeos)) {
|
||||
$topicNeos = [];
|
||||
}
|
||||
|
||||
$forumNeos = $user->subscriptions->where('forum_id', '>', '0')->pluck('forum_id')->toArray();
|
||||
if (! \is_array($forumNeos)) {
|
||||
if ( ! \is_array($forumNeos)) {
|
||||
$forumNeos = [];
|
||||
}
|
||||
|
||||
$builder = Forum::with('subscription_topics')->selectRaw('forums.id,max(forums.position) as position,max(forums.num_topic) as num_topic,max(forums.num_post) as num_post,max(forums.last_topic_id) as last_topic_id,max(forums.last_topic_name) as last_topic_name,max(forums.last_post_user_id) as last_post_user_id,max(forums.last_post_user_username) as last_post_user_username,max(forums.name) as name,max(forums.slug) as slug,max(forums.description) as description,max(forums.parent_id) as parent_id,max(forums.created_at),max(forums.updated_at),max(topics.id) as topic_id,max(topics.created_at) as topic_created_at')->leftJoin('topics', 'forums.id', '=', 'topics.forum_id')->whereIntegerNotInRaw('topics.forum_id', $pests)->where(function ($query) use ($topicNeos, $forumNeos) {
|
||||
$builder = Forum::with('subscription_topics')->selectRaw('forums.id,max(forums.position) as position,max(forums.num_topic) as num_topic,max(forums.num_post) as num_post,max(forums.last_topic_id) as last_topic_id,max(forums.last_topic_name) as last_topic_name,max(forums.last_post_user_id) as last_post_user_id,max(forums.last_post_user_username) as last_post_user_username,max(forums.name) as name,max(forums.slug) as slug,max(forums.description) as description,max(forums.parent_id) as parent_id,max(forums.created_at),max(forums.updated_at),max(topics.id) as topic_id,max(topics.created_at) as topic_created_at')->leftJoin('topics', 'forums.id', '=', 'topics.forum_id')->whereIntegerNotInRaw('topics.forum_id', $pests)->where(function ($query) use ($topicNeos, $forumNeos): void {
|
||||
$query->whereIntegerInRaw('topics.id', $topicNeos)->orWhereIntegerInRaw('forums.id', $forumNeos);
|
||||
})->groupBy('forums.id');
|
||||
|
||||
@@ -199,7 +199,7 @@ class ForumController extends Controller
|
||||
|
||||
$params = $request->all();
|
||||
|
||||
return \view('forum.subscriptions', [
|
||||
return view('forum.subscriptions', [
|
||||
'results' => $results,
|
||||
'user' => $user,
|
||||
'name' => $request->input('name'),
|
||||
@@ -221,7 +221,7 @@ class ForumController extends Controller
|
||||
$user = $request->user();
|
||||
|
||||
$pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray();
|
||||
if (! \is_array($pests)) {
|
||||
if ( ! \is_array($pests)) {
|
||||
$pests = [];
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ class ForumController extends Controller
|
||||
// Total Topics Count
|
||||
$numTopics = Topic::count();
|
||||
|
||||
return \view('forum.latest_topics', [
|
||||
return view('forum.latest_topics', [
|
||||
'results' => $results,
|
||||
'user' => $user,
|
||||
'num_posts' => $numPosts,
|
||||
@@ -251,7 +251,7 @@ class ForumController extends Controller
|
||||
$user = $request->user();
|
||||
|
||||
$pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray();
|
||||
if (! \is_array($pests)) {
|
||||
if ( ! \is_array($pests)) {
|
||||
$pests = [];
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ class ForumController extends Controller
|
||||
// Total Topics Count
|
||||
$numTopics = Topic::count();
|
||||
|
||||
return \view('forum.latest_posts', [
|
||||
return view('forum.latest_posts', [
|
||||
'results' => $results,
|
||||
'user' => $user,
|
||||
'num_posts' => $numPosts,
|
||||
@@ -287,7 +287,7 @@ class ForumController extends Controller
|
||||
// Total Topics Count
|
||||
$numTopics = Topic::count();
|
||||
|
||||
return \view('forum.index', [
|
||||
return view('forum.index', [
|
||||
'categories' => $categories,
|
||||
'num_posts' => $numPosts,
|
||||
'num_forums' => $numForums,
|
||||
@@ -312,20 +312,20 @@ class ForumController extends Controller
|
||||
|
||||
// Check if this is a category or forum
|
||||
if ($forum->parent_id == 0) {
|
||||
return \to_route('forums.categories.show', ['id' => $forum->id]);
|
||||
return to_route('forums.categories.show', ['id' => $forum->id]);
|
||||
}
|
||||
|
||||
// Check if the user has permission to view the forum
|
||||
$category = Forum::findOrFail($forum->id);
|
||||
if (! $category->getPermission()->show_forum) {
|
||||
return \to_route('forums.index')
|
||||
if ( ! $category->getPermission()->show_forum) {
|
||||
return to_route('forums.index')
|
||||
->withErrors('You Do Not Have Access To This Forum!');
|
||||
}
|
||||
|
||||
// Fetch topics->posts in descending order
|
||||
$topics = $forum->topics()->latest('pinned')->latest('last_reply_at')->latest()->paginate(25);
|
||||
|
||||
return \view('forum.display', [
|
||||
return view('forum.display', [
|
||||
'forum' => $forum,
|
||||
'topics' => $topics,
|
||||
'category' => $category,
|
||||
|
||||
Reference in New Issue
Block a user