Adopt PSR-2 coding style

The Laravel framework adopts the PSR-2 coding style in version 5.1.
Laravel apps *should* adopt this coding style as well. Read the
[PSR-2 coding style guide][1] for more details and check out [PHPCS][2]
to use as a code formatting tool.

[1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
[2]: https://github.com/squizlabs/PHP_CodeSniffer
This commit is contained in:
Laravel Shift
2019-02-22 03:22:51 +00:00
parent 6965e34d4f
commit 12397c9e6a
5 changed files with 14 additions and 21 deletions
+7 -11
View File
@@ -110,7 +110,7 @@ class ForumController extends Controller
$result->where([['topics.name', 'like', '%'.$request->input('name').'%']]);
}
if ($request->has('subscribed') && $request->input('subscribed') == 1) {
$result->where(function ($query) use ($topic_neos,$forum_neos) {
$result->where(function ($query) use ($topic_neos, $forum_neos) {
$query->whereIn('topics.id', $topic_neos)->orWhereIn('topics.forum_id', $forum_neos);
});
} elseif ($request->has('notsubscribed') && $request->input('notsubscribed') == 1) {
@@ -151,7 +151,7 @@ class ForumController extends Controller
if ($category > 0 && $category < 99999999999) {
$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) {
$query->where('topics.forum_id', '=', $category)->orWhereIn('topics.forum_id', $children);
});
}
@@ -198,8 +198,7 @@ class ForumController extends Controller
'num_forums' => $num_forums,
'num_topics' => $num_topics,
'params' => $params,
]
);
]);
}
/**
@@ -229,7 +228,7 @@ class ForumController extends Controller
}
$logger = 'forum.subscriptions';
$result = 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_topic_slug) as last_topic_slug,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')->whereNotIn('topics.forum_id', $pests)->where(function ($query) use ($topic_neos,$forum_neos) {
$result = 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_topic_slug) as last_topic_slug,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')->whereNotIn('topics.forum_id', $pests)->where(function ($query) use ($topic_neos, $forum_neos) {
$query->whereIn('topics.id', $topic_neos)->orWhereIn('forums.id', $forum_neos);
})->groupBy('forums.id');
@@ -256,8 +255,7 @@ class ForumController extends Controller
'params' => $params,
'forum_neos' => $forum_neos,
'topic_neos' => $topic_neos,
]
);
]);
}
/**
@@ -291,8 +289,7 @@ class ForumController extends Controller
'num_posts' => $num_posts,
'num_forums' => $num_forums,
'num_topics' => $num_topics,
]
);
]);
}
/**
@@ -326,8 +323,7 @@ class ForumController extends Controller
'num_posts' => $num_posts,
'num_forums' => $num_forums,
'num_topics' => $num_topics,
]
);
]);
}
/**
+3 -6
View File
@@ -150,8 +150,7 @@ class UserController extends Controller
'route' => 'follower',
'results' => $results,
'user' => $user,
]
);
]);
}
/**
@@ -170,8 +169,7 @@ class UserController extends Controller
'route' => 'forum',
'results' => $results,
'user' => $user,
]
);
]);
}
/**
@@ -190,8 +188,7 @@ class UserController extends Controller
'route' => 'forum',
'results' => $results,
'user' => $user,
]
);
]);
}
/**
+2 -2
View File
@@ -255,7 +255,7 @@ class ChatRepository
'user.chatStatus',
'receiver.group',
'receiver.chatStatus',
])->where(function ($query) use ($sender_id,$bot_id) {
])->where(function ($query) use ($sender_id, $bot_id) {
$query->whereRaw('(user_id = ? and receiver_id = ?)', [$sender_id, 1])->orWhereRaw('(user_id = ? and receiver_id = ?)', [1, $sender_id]);
})->where('bot_id', '=', $bot_id)
->orderBy('id', 'desc')
@@ -272,7 +272,7 @@ class ChatRepository
'user.chatStatus',
'receiver.group',
'receiver.chatStatus',
])->where(function ($query) use ($sender_id,$target_id) {
])->where(function ($query) use ($sender_id, $target_id) {
$query->whereRaw('(user_id = ? and receiver_id = ?)', [$sender_id, $target_id])->orWhereRaw('(user_id = ? and receiver_id = ?)', [$target_id, $sender_id]);
})
->orderBy('id', 'desc')
+1 -1
View File
@@ -91,7 +91,7 @@ class UserNotification extends Model
*/
public function setDefaultValues($type = 'default')
{
foreach ($this->casts as $k=>$v) {
foreach ($this->casts as $k => $v) {
if ($v == 'array') {
$this->$k = $this->expected_groups;
}
+1 -1
View File
@@ -94,7 +94,7 @@ class UserPrivacy extends Model
*/
public function setDefaultValues($type = 'default')
{
foreach ($this->casts as $k=>$v) {
foreach ($this->casts as $k => $v) {
if ($v == 'array') {
$this->$k = $this->expected_groups;
}