remove "CheckPlayerExists" event in some places
This commit is contained in:
parent
1170a528d6
commit
f46737c8e3
@ -152,12 +152,11 @@ class AuthController extends Controller
|
||||
|
||||
$dispatcher->dispatch('auth.registration.attempt', [$data]);
|
||||
|
||||
if (option('register_with_player_name')) {
|
||||
event(new Events\CheckPlayerExists($request->get('player_name')));
|
||||
|
||||
if (Player::where('name', $request->get('player_name'))->first()) {
|
||||
return json(trans('user.player.add.repeated'), 2);
|
||||
}
|
||||
if (
|
||||
option('register_with_player_name') &&
|
||||
Player::where('name', $request->input('player_name'))->count() > 0
|
||||
) {
|
||||
return json(trans('user.player.add.repeated'), 2);
|
||||
}
|
||||
|
||||
// If amount of registered accounts of IP is more than allowed amounts,
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\CheckPlayerExists;
|
||||
use App\Events\PlayerWasAdded;
|
||||
use App\Events\PlayerWasDeleted;
|
||||
use App\Events\PlayerWillBeAdded;
|
||||
@ -88,7 +87,6 @@ class PlayerController extends Controller
|
||||
])['name'];
|
||||
|
||||
$dispatcher->dispatch('player.add.attempt', [$name, $user]);
|
||||
event(new CheckPlayerExists($name));
|
||||
|
||||
if (!Player::where('name', $name)->get()->isEmpty()) {
|
||||
return json(trans('user.player.add.repeated'), 6);
|
||||
@ -243,7 +241,6 @@ class PlayerController extends Controller
|
||||
])['player'];
|
||||
$user = Auth::user();
|
||||
|
||||
event(new CheckPlayerExists($name));
|
||||
$player = Player::where('name', $name)->first();
|
||||
if (!$player) {
|
||||
$dispatcher->dispatch('player.adding', [$name, $user]);
|
||||
|
@ -81,7 +81,6 @@ class PlayerControllerTest extends TestCase
|
||||
|
||||
return true;
|
||||
});
|
||||
Event::assertDispatched(Events\CheckPlayerExists::class);
|
||||
Event::assertNotDispatched('player.adding');
|
||||
Event::assertNotDispatched('player.added');
|
||||
|
||||
@ -408,7 +407,6 @@ class PlayerControllerTest extends TestCase
|
||||
'code' => 0,
|
||||
'message' => trans('user.player.bind.success'),
|
||||
]);
|
||||
Event::assertDispatched(Events\CheckPlayerExists::class);
|
||||
Event::assertDispatched('player.adding', function ($event, $payload) use ($user) {
|
||||
$this->assertEquals('abc', $payload[0]);
|
||||
$this->assertEquals($user->uid, $payload[1]->uid);
|
||||
|
Loading…
Reference in New Issue
Block a user