refactor
This commit is contained in:
parent
ba251beeca
commit
0acfa1174b
@ -44,7 +44,7 @@ class AuthController extends Controller
|
|||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter
|
Filter $filter
|
||||||
) {
|
) {
|
||||||
$this->validate($request, [
|
$request->validate([
|
||||||
'identification' => 'required',
|
'identification' => 'required',
|
||||||
'password' => 'required|min:6|max:32',
|
'password' => 'required|min:6|max:32',
|
||||||
]);
|
]);
|
||||||
@ -77,7 +77,7 @@ class AuthController extends Controller
|
|||||||
$loginFails = (int) Cache::get($loginFailsCacheKey, 0);
|
$loginFails = (int) Cache::get($loginFailsCacheKey, 0);
|
||||||
|
|
||||||
if ($loginFails > 3) {
|
if ($loginFails > 3) {
|
||||||
$this->validate($request, ['captcha' => ['required', $captcha]]);
|
$request->validate(['captcha' => ['required', $captcha]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
@ -159,7 +159,7 @@ class AuthController extends Controller
|
|||||||
'max:'.option('player_name_length_max'),
|
'max:'.option('player_name_length_max'),
|
||||||
]] :
|
]] :
|
||||||
['nickname' => 'required|max:255'];
|
['nickname' => 'required|max:255'];
|
||||||
$data = $this->validate($request, array_merge([
|
$data = $request->validate(array_merge([
|
||||||
'email' => 'required|email|unique:users',
|
'email' => 'required|email|unique:users',
|
||||||
'password' => 'required|min:8|max:32',
|
'password' => 'required|min:8|max:32',
|
||||||
'captcha' => ['required', $captcha],
|
'captcha' => ['required', $captcha],
|
||||||
@ -239,7 +239,7 @@ class AuthController extends Controller
|
|||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Filter $filter
|
Filter $filter
|
||||||
) {
|
) {
|
||||||
$data = $this->validate($request, [
|
$data = $request->validate([
|
||||||
'email' => 'required|email',
|
'email' => 'required|email',
|
||||||
'captcha' => ['required', $captcha],
|
'captcha' => ['required', $captcha],
|
||||||
]);
|
]);
|
||||||
@ -301,7 +301,7 @@ class AuthController extends Controller
|
|||||||
{
|
{
|
||||||
abort_unless($request->hasValidSignature(false), 403, trans('auth.reset.invalid'));
|
abort_unless($request->hasValidSignature(false), 403, trans('auth.reset.invalid'));
|
||||||
|
|
||||||
['password' => $password] = $this->validate($request, [
|
['password' => $password] = $request->validate([
|
||||||
'password' => 'required|min:8|max:32',
|
'password' => 'required|min:8|max:32',
|
||||||
]);
|
]);
|
||||||
$user = User::find($uid);
|
$user = User::find($uid);
|
||||||
@ -326,7 +326,7 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
public function fillEmail(Request $request)
|
public function fillEmail(Request $request)
|
||||||
{
|
{
|
||||||
$email = $this->validate($request, ['email' => 'required|email|unique:users'])['email'];
|
$email = $request->validate(['email' => 'required|email|unique:users'])['email'];
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
$user->email = $email;
|
$user->email = $email;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
@ -12,7 +12,7 @@ class NotificationsController extends Controller
|
|||||||
{
|
{
|
||||||
public function send(Request $request)
|
public function send(Request $request)
|
||||||
{
|
{
|
||||||
$data = $this->validate($request, [
|
$data = $request->validate([
|
||||||
'receiver' => 'required|in:all,normal,uid,email',
|
'receiver' => 'required|in:all,normal,uid,email',
|
||||||
'uid' => 'required_if:receiver,uid|nullable|integer|exists:users',
|
'uid' => 'required_if:receiver,uid|nullable|integer|exists:users',
|
||||||
'email' => 'required_if:receiver,email|nullable|email|exists:users',
|
'email' => 'required_if:receiver,email|nullable|email|exists:users',
|
||||||
|
@ -73,7 +73,7 @@ class PlayerController extends Controller
|
|||||||
return json(trans('user.player.add.single'), 1);
|
return json(trans('user.player.add.single'), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = $this->validate($request, [
|
$name = $request->validate([
|
||||||
'name' => [
|
'name' => [
|
||||||
'required',
|
'required',
|
||||||
new Rules\PlayerName(),
|
new Rules\PlayerName(),
|
||||||
@ -145,7 +145,7 @@ class PlayerController extends Controller
|
|||||||
Filter $filter,
|
Filter $filter,
|
||||||
$pid
|
$pid
|
||||||
) {
|
) {
|
||||||
$newName = $this->validate($request, [
|
$newName = $request->validate([
|
||||||
'name' => [
|
'name' => [
|
||||||
'required',
|
'required',
|
||||||
new Rules\PlayerName(),
|
new Rules\PlayerName(),
|
||||||
@ -227,7 +227,7 @@ class PlayerController extends Controller
|
|||||||
|
|
||||||
public function bind(Request $request, Dispatcher $dispatcher)
|
public function bind(Request $request, Dispatcher $dispatcher)
|
||||||
{
|
{
|
||||||
$name = $this->validate($request, [
|
$name = $request->validate([
|
||||||
'player' => [
|
'player' => [
|
||||||
'required',
|
'required',
|
||||||
new Rules\PlayerName(),
|
new Rules\PlayerName(),
|
||||||
|
@ -46,7 +46,7 @@ class PlayersManagementController extends Controller
|
|||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher
|
Dispatcher $dispatcher
|
||||||
) {
|
) {
|
||||||
$name = $this->validate($request, [
|
$name = $request->validate([
|
||||||
'player_name' => [
|
'player_name' => [
|
||||||
'required',
|
'required',
|
||||||
new Rules\PlayerName(),
|
new Rules\PlayerName(),
|
||||||
@ -72,7 +72,7 @@ class PlayersManagementController extends Controller
|
|||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher
|
Dispatcher $dispatcher
|
||||||
) {
|
) {
|
||||||
$uid = $this->validate($request, ['uid' => 'required|integer'])['uid'];
|
$uid = $request->validate(['uid' => 'required|integer'])['uid'];
|
||||||
|
|
||||||
$dispatcher->dispatch('player.owner.updating', [$player, $uid]);
|
$dispatcher->dispatch('player.owner.updating', [$player, $uid]);
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class PlayersManagementController extends Controller
|
|||||||
Request $request,
|
Request $request,
|
||||||
Dispatcher $dispatcher
|
Dispatcher $dispatcher
|
||||||
) {
|
) {
|
||||||
$data = $this->validate($request, [
|
$data = $request->validate([
|
||||||
'tid' => 'required|integer',
|
'tid' => 'required|integer',
|
||||||
'type' => ['required', Rule::in(['skin', 'cape'])],
|
'type' => ['required', Rule::in(['skin', 'cape'])],
|
||||||
]);
|
]);
|
||||||
|
@ -16,7 +16,7 @@ class ReportController extends Controller
|
|||||||
{
|
{
|
||||||
public function submit(Request $request, Dispatcher $dispatcher, Filter $filter)
|
public function submit(Request $request, Dispatcher $dispatcher, Filter $filter)
|
||||||
{
|
{
|
||||||
$data = $this->validate($request, [
|
$data = $request->validate([
|
||||||
'tid' => 'required|exists:textures',
|
'tid' => 'required|exists:textures',
|
||||||
'reason' => 'required',
|
'reason' => 'required',
|
||||||
]);
|
]);
|
||||||
|
@ -105,7 +105,7 @@ class SetupController extends Controller
|
|||||||
|
|
||||||
public function finish(Request $request, Filesystem $filesystem, Artisan $artisan)
|
public function finish(Request $request, Filesystem $filesystem, Artisan $artisan)
|
||||||
{
|
{
|
||||||
$data = $this->validate($request, [
|
$data = $request->validate([
|
||||||
'email' => 'required|email',
|
'email' => 'required|email',
|
||||||
'nickname' => 'required',
|
'nickname' => 'required',
|
||||||
'password' => 'required|min:8|max:32|confirmed',
|
'password' => 'required|min:8|max:32|confirmed',
|
||||||
|
@ -308,7 +308,7 @@ class SkinlibController extends Controller
|
|||||||
|
|
||||||
public function rename(Request $request)
|
public function rename(Request $request)
|
||||||
{
|
{
|
||||||
$this->validate($request, [
|
$request->validate([
|
||||||
'tid' => 'required|integer',
|
'tid' => 'required|integer',
|
||||||
'new_name' => 'required',
|
'new_name' => 'required',
|
||||||
]);
|
]);
|
||||||
@ -335,7 +335,7 @@ class SkinlibController extends Controller
|
|||||||
public function model(Request $request)
|
public function model(Request $request)
|
||||||
{
|
{
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
$data = $this->validate($request, [
|
$data = $request->validate([
|
||||||
'tid' => 'required|integer',
|
'tid' => 'required|integer',
|
||||||
'model' => 'required|in:steve,alex,cape',
|
'model' => 'required|in:steve,alex,cape',
|
||||||
]);
|
]);
|
||||||
@ -364,7 +364,7 @@ class SkinlibController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->validate($request, [
|
$request->validate([
|
||||||
'name' => [
|
'name' => [
|
||||||
'required',
|
'required',
|
||||||
option('texture_name_regexp') ? 'regex:'.option('texture_name_regexp') : 'string',
|
option('texture_name_regexp') ? 'regex:'.option('texture_name_regexp') : 'string',
|
||||||
|
@ -16,7 +16,7 @@ class TranslationsController extends Controller
|
|||||||
|
|
||||||
public function create(Request $request, Application $app, JavaScript $js)
|
public function create(Request $request, Application $app, JavaScript $js)
|
||||||
{
|
{
|
||||||
$data = $this->validate($request, [
|
$data = $request->validate([
|
||||||
'group' => 'required|string',
|
'group' => 'required|string',
|
||||||
'key' => 'required|string',
|
'key' => 'required|string',
|
||||||
'text' => 'required|string',
|
'text' => 'required|string',
|
||||||
@ -38,7 +38,7 @@ class TranslationsController extends Controller
|
|||||||
|
|
||||||
public function update(Request $request, Application $app, JavaScript $js)
|
public function update(Request $request, Application $app, JavaScript $js)
|
||||||
{
|
{
|
||||||
$data = $this->validate($request, [
|
$data = $request->validate([
|
||||||
'id' => 'required|integer',
|
'id' => 'required|integer',
|
||||||
'text' => 'required|string',
|
'text' => 'required|string',
|
||||||
]);
|
]);
|
||||||
@ -56,7 +56,7 @@ class TranslationsController extends Controller
|
|||||||
|
|
||||||
public function delete(Request $request, Application $app, JavaScript $js)
|
public function delete(Request $request, Application $app, JavaScript $js)
|
||||||
{
|
{
|
||||||
['id' => $id] = $this->validate($request, ['id' => 'required|integer']);
|
['id' => $id] = $request->validate(['id' => 'required|integer']);
|
||||||
$line = LanguageLine::findOrFail($id);
|
$line = LanguageLine::findOrFail($id);
|
||||||
$line->delete();
|
$line->delete();
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ class UserController extends Controller
|
|||||||
return json(trans('user.profile.nickname.single'), 1);
|
return json(trans('user.profile.nickname.single'), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->validate($request, ['new_nickname' => 'required']);
|
$request->validate(['new_nickname' => 'required']);
|
||||||
|
|
||||||
$nickname = $request->input('new_nickname');
|
$nickname = $request->input('new_nickname');
|
||||||
$user->nickname = $nickname;
|
$user->nickname = $nickname;
|
||||||
@ -261,7 +261,7 @@ class UserController extends Controller
|
|||||||
return json(trans('user.profile.nickname.success', ['nickname' => $nickname]), 0);
|
return json(trans('user.profile.nickname.success', ['nickname' => $nickname]), 0);
|
||||||
|
|
||||||
case 'password':
|
case 'password':
|
||||||
$this->validate($request, [
|
$request->validate([
|
||||||
'current_password' => 'required|min:6|max:32',
|
'current_password' => 'required|min:6|max:32',
|
||||||
'new_password' => 'required|min:8|max:32',
|
'new_password' => 'required|min:8|max:32',
|
||||||
]);
|
]);
|
||||||
@ -279,7 +279,7 @@ class UserController extends Controller
|
|||||||
return json(trans('user.profile.password.success'), 0);
|
return json(trans('user.profile.password.success'), 0);
|
||||||
|
|
||||||
case 'email':
|
case 'email':
|
||||||
$this->validate($request, [
|
$request->validate([
|
||||||
'new_email' => 'required|email',
|
'new_email' => 'required|email',
|
||||||
'password' => 'required|min:6|max:32',
|
'password' => 'required|min:6|max:32',
|
||||||
]);
|
]);
|
||||||
@ -304,7 +304,7 @@ class UserController extends Controller
|
|||||||
return json(trans('user.profile.email.success'), 0);
|
return json(trans('user.profile.email.success'), 0);
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$this->validate($request, [
|
$request->validate([
|
||||||
'password' => 'required|min:6|max:32',
|
'password' => 'required|min:6|max:32',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ class UserController extends Controller
|
|||||||
|
|
||||||
public function setAvatar(Request $request, Filter $filter, Dispatcher $dispatcher)
|
public function setAvatar(Request $request, Filter $filter, Dispatcher $dispatcher)
|
||||||
{
|
{
|
||||||
$this->validate($request, ['tid' => 'required|integer']);
|
$request->validate(['tid' => 'required|integer']);
|
||||||
$tid = $request->input('tid');
|
$tid = $request->input('tid');
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user