diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index a19ca51f..06226e4d 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -44,7 +44,7 @@ class AuthController extends Controller Dispatcher $dispatcher, Filter $filter ) { - $this->validate($request, [ + $request->validate([ 'identification' => 'required', 'password' => 'required|min:6|max:32', ]); @@ -77,7 +77,7 @@ class AuthController extends Controller $loginFails = (int) Cache::get($loginFailsCacheKey, 0); if ($loginFails > 3) { - $this->validate($request, ['captcha' => ['required', $captcha]]); + $request->validate(['captcha' => ['required', $captcha]]); } if (!$user) { @@ -159,7 +159,7 @@ class AuthController extends Controller 'max:'.option('player_name_length_max'), ]] : ['nickname' => 'required|max:255']; - $data = $this->validate($request, array_merge([ + $data = $request->validate(array_merge([ 'email' => 'required|email|unique:users', 'password' => 'required|min:8|max:32', 'captcha' => ['required', $captcha], @@ -239,7 +239,7 @@ class AuthController extends Controller Dispatcher $dispatcher, Filter $filter ) { - $data = $this->validate($request, [ + $data = $request->validate([ 'email' => 'required|email', 'captcha' => ['required', $captcha], ]); @@ -301,7 +301,7 @@ class AuthController extends Controller { 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', ]); $user = User::find($uid); @@ -326,7 +326,7 @@ class AuthController extends Controller 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->email = $email; $user->save(); diff --git a/app/Http/Controllers/NotificationsController.php b/app/Http/Controllers/NotificationsController.php index 1fda0925..047b782b 100644 --- a/app/Http/Controllers/NotificationsController.php +++ b/app/Http/Controllers/NotificationsController.php @@ -12,7 +12,7 @@ class NotificationsController extends Controller { public function send(Request $request) { - $data = $this->validate($request, [ + $data = $request->validate([ 'receiver' => 'required|in:all,normal,uid,email', 'uid' => 'required_if:receiver,uid|nullable|integer|exists:users', 'email' => 'required_if:receiver,email|nullable|email|exists:users', diff --git a/app/Http/Controllers/PlayerController.php b/app/Http/Controllers/PlayerController.php index 30225e7b..a474c668 100644 --- a/app/Http/Controllers/PlayerController.php +++ b/app/Http/Controllers/PlayerController.php @@ -73,7 +73,7 @@ class PlayerController extends Controller return json(trans('user.player.add.single'), 1); } - $name = $this->validate($request, [ + $name = $request->validate([ 'name' => [ 'required', new Rules\PlayerName(), @@ -145,7 +145,7 @@ class PlayerController extends Controller Filter $filter, $pid ) { - $newName = $this->validate($request, [ + $newName = $request->validate([ 'name' => [ 'required', new Rules\PlayerName(), @@ -227,7 +227,7 @@ class PlayerController extends Controller public function bind(Request $request, Dispatcher $dispatcher) { - $name = $this->validate($request, [ + $name = $request->validate([ 'player' => [ 'required', new Rules\PlayerName(), diff --git a/app/Http/Controllers/PlayersManagementController.php b/app/Http/Controllers/PlayersManagementController.php index e0e16b9a..d3928df5 100644 --- a/app/Http/Controllers/PlayersManagementController.php +++ b/app/Http/Controllers/PlayersManagementController.php @@ -46,7 +46,7 @@ class PlayersManagementController extends Controller Request $request, Dispatcher $dispatcher ) { - $name = $this->validate($request, [ + $name = $request->validate([ 'player_name' => [ 'required', new Rules\PlayerName(), @@ -72,7 +72,7 @@ class PlayersManagementController extends Controller Request $request, Dispatcher $dispatcher ) { - $uid = $this->validate($request, ['uid' => 'required|integer'])['uid']; + $uid = $request->validate(['uid' => 'required|integer'])['uid']; $dispatcher->dispatch('player.owner.updating', [$player, $uid]); @@ -98,7 +98,7 @@ class PlayersManagementController extends Controller Request $request, Dispatcher $dispatcher ) { - $data = $this->validate($request, [ + $data = $request->validate([ 'tid' => 'required|integer', 'type' => ['required', Rule::in(['skin', 'cape'])], ]); diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 3f11fb32..7b922ab4 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -16,7 +16,7 @@ class ReportController extends Controller { public function submit(Request $request, Dispatcher $dispatcher, Filter $filter) { - $data = $this->validate($request, [ + $data = $request->validate([ 'tid' => 'required|exists:textures', 'reason' => 'required', ]); diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 45702adb..6915b681 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -105,7 +105,7 @@ class SetupController extends Controller public function finish(Request $request, Filesystem $filesystem, Artisan $artisan) { - $data = $this->validate($request, [ + $data = $request->validate([ 'email' => 'required|email', 'nickname' => 'required', 'password' => 'required|min:8|max:32|confirmed', diff --git a/app/Http/Controllers/SkinlibController.php b/app/Http/Controllers/SkinlibController.php index d20cbefc..11018cdc 100644 --- a/app/Http/Controllers/SkinlibController.php +++ b/app/Http/Controllers/SkinlibController.php @@ -308,7 +308,7 @@ class SkinlibController extends Controller public function rename(Request $request) { - $this->validate($request, [ + $request->validate([ 'tid' => 'required|integer', 'new_name' => 'required', ]); @@ -335,7 +335,7 @@ class SkinlibController extends Controller public function model(Request $request) { $user = $request->user(); - $data = $this->validate($request, [ + $data = $request->validate([ 'tid' => 'required|integer', 'model' => 'required|in:steve,alex,cape', ]); @@ -364,7 +364,7 @@ class SkinlibController extends Controller } } - $this->validate($request, [ + $request->validate([ 'name' => [ 'required', option('texture_name_regexp') ? 'regex:'.option('texture_name_regexp') : 'string', diff --git a/app/Http/Controllers/TranslationsController.php b/app/Http/Controllers/TranslationsController.php index 9a05c9cf..8121168d 100644 --- a/app/Http/Controllers/TranslationsController.php +++ b/app/Http/Controllers/TranslationsController.php @@ -16,7 +16,7 @@ class TranslationsController extends Controller public function create(Request $request, Application $app, JavaScript $js) { - $data = $this->validate($request, [ + $data = $request->validate([ 'group' => 'required|string', 'key' => 'required|string', 'text' => 'required|string', @@ -38,7 +38,7 @@ class TranslationsController extends Controller public function update(Request $request, Application $app, JavaScript $js) { - $data = $this->validate($request, [ + $data = $request->validate([ 'id' => 'required|integer', 'text' => 'required|string', ]); @@ -56,7 +56,7 @@ class TranslationsController extends Controller 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->delete(); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 8559015a..7887a106 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -249,7 +249,7 @@ class UserController extends Controller return json(trans('user.profile.nickname.single'), 1); } - $this->validate($request, ['new_nickname' => 'required']); + $request->validate(['new_nickname' => 'required']); $nickname = $request->input('new_nickname'); $user->nickname = $nickname; @@ -261,7 +261,7 @@ class UserController extends Controller return json(trans('user.profile.nickname.success', ['nickname' => $nickname]), 0); case 'password': - $this->validate($request, [ + $request->validate([ 'current_password' => 'required|min:6|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); case 'email': - $this->validate($request, [ + $request->validate([ 'new_email' => 'required|email', 'password' => 'required|min:6|max:32', ]); @@ -304,7 +304,7 @@ class UserController extends Controller return json(trans('user.profile.email.success'), 0); case 'delete': - $this->validate($request, [ + $request->validate([ 'password' => 'required|min:6|max:32', ]); @@ -333,7 +333,7 @@ class UserController extends Controller public function setAvatar(Request $request, Filter $filter, Dispatcher $dispatcher) { - $this->validate($request, ['tid' => 'required|integer']); + $request->validate(['tid' => 'required|integer']); $tid = $request->input('tid'); $user = auth()->user();