This commit is contained in:
Pig Fang 2020-05-31 16:37:09 +08:00
parent ba251beeca
commit 0acfa1174b
9 changed files with 26 additions and 26 deletions

View File

@ -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();

View File

@ -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',

View File

@ -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(),

View File

@ -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'])],
]);

View File

@ -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',
]);

View File

@ -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',

View File

@ -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',

View File

@ -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();

View File

@ -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();