working on events & data adapter
This commit is contained in:
parent
167c40f550
commit
6aaec6f658
|
|
@ -11,7 +11,7 @@ class ConfigureUserMenu extends Event
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Array &$menu)
|
||||
public function __construct(array &$menu)
|
||||
{
|
||||
// pass array by reference
|
||||
$this->menu = &$menu;
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @Author: printempw
|
||||
* @Date: 2016-10-17 14:12:54
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-10-17 14:13:00
|
||||
*/
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class UserInstantiated extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $uid;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($uid)
|
||||
{
|
||||
$this->uid = $uid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ class UserTryToLogin extends Event
|
|||
|
||||
public $identification;
|
||||
|
||||
public $auth_type;
|
||||
public $authType;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
|
|
@ -20,7 +20,7 @@ class UserTryToLogin extends Event
|
|||
public function __construct($identification, $auth_type)
|
||||
{
|
||||
$this->identification = $identification;
|
||||
$this->auth_type = $auth_type;
|
||||
$this->authType = $auth_type;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use App\Models\Texture;
|
|||
use Illuminate\Http\Request;
|
||||
use App\Events\PlayerWasAdded;
|
||||
use App\Events\PlayerWasDeleted;
|
||||
use App\Events\CheckPlayerExists;
|
||||
use App\Exceptions\PrettyPageException;
|
||||
use App\Services\Repositories\UserRepository;
|
||||
|
||||
|
|
@ -50,6 +51,8 @@ class PlayerController extends Controller
|
|||
'player_name' => 'required|'.(Option::get('allow_chinese_playername') == "1") ? 'pname_chinese' : 'player_name'
|
||||
]);
|
||||
|
||||
Event::fire(new CheckPlayerExists($request->input('player_name')));
|
||||
|
||||
if (!Player::where('player_name', $request->input('player_name'))->get()->isEmpty()) {
|
||||
return json(trans('user.player.add.repeated'), 6);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Option;
|
|||
use Storage;
|
||||
use Response;
|
||||
use Minecraft;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use App\Models\Player;
|
||||
use App\Models\Texture;
|
||||
|
|
@ -30,12 +31,16 @@ class TextureController extends Controller
|
|||
$player = $this->getPlayerInstance($player_name);
|
||||
|
||||
if ($api == "csl") {
|
||||
return Response::rawJson($player->getJsonProfile(Player::CSL_API));
|
||||
$content = $player->getJsonProfile(Player::CSL_API);
|
||||
} else if ($api == "usm") {
|
||||
return Response::rawJson($player->getJsonProfile(Player::USM_API));
|
||||
$content = $player->getJsonProfile(Player::USM_API);
|
||||
} else {
|
||||
return Response::rawJson($player->getJsonProfile(Option::get('api_type')));
|
||||
$content = $player->getJsonProfile(Option::get('api_type'));
|
||||
}
|
||||
|
||||
return Response::rawJson($content, 200, [
|
||||
'Last-Modified' => Carbon::createFromTimestamp($player->getLastModified())->format('D, d M Y H:i:s \G\M\T')
|
||||
]);
|
||||
}
|
||||
|
||||
public function jsonWithApi($api, $player_name)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Database
|
|||
public function table($table_name, $no_prefix = false)
|
||||
{
|
||||
if ($this->connection->real_escape_string($table_name) == $table_name) {
|
||||
$this->table_name = $no_prefix ? $table_name : config('database.connections.mysql.prefix').$table_name;
|
||||
$this->table_name = $no_prefix ? "{$this->config['database']}.$table_name" : config('database.connections.mysql.prefix').$table_name;
|
||||
return $this;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Table name contains invalid characters', 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user