aboutsummaryrefslogtreecommitdiffhomepage
path: root/infrastructure
diff options
context:
space:
mode:
Diffstat (limited to 'infrastructure')
-rw-r--r--infrastructure/Api/Controllers/DefaultApiController.php16
-rw-r--r--infrastructure/Api/routes_public.php3
-rw-r--r--infrastructure/Auth/AuthServiceProvider.php41
-rw-r--r--infrastructure/Auth/Controllers/LoginController.php38
-rw-r--r--infrastructure/Auth/Exceptions/InvalidCredentialsException.php13
-rw-r--r--infrastructure/Auth/LoginProxy.php129
-rw-r--r--infrastructure/Auth/Middleware/AccessTokenChecker.php37
-rw-r--r--infrastructure/Auth/Requests/LoginRequest.php21
-rw-r--r--infrastructure/Auth/routes_protected.php3
-rw-r--r--infrastructure/Auth/routes_public.php4
-rw-r--r--infrastructure/Console/Commands/StartServer.sh9
-rw-r--r--infrastructure/Console/Commands/StartServerCommand.php30
-rw-r--r--infrastructure/Console/Commands/WebSocketServerCommand.php37
-rw-r--r--infrastructure/Console/Kernel.php33
-rw-r--r--infrastructure/Database/Eloquent/Model.php9
-rw-r--r--infrastructure/Database/Eloquent/Repository.php9
-rw-r--r--infrastructure/Events/Event.php8
-rw-r--r--infrastructure/Exceptions/Formatters/ExceptionFormatter.php30
-rw-r--r--infrastructure/Exceptions/Handler.php50
-rw-r--r--infrastructure/Http/ApiRequest.php21
-rw-r--r--infrastructure/Http/Controller.php10
-rw-r--r--infrastructure/Http/Kernel.php47
-rw-r--r--infrastructure/Http/Middleware/EncryptCookies.php17
-rw-r--r--infrastructure/Http/RouteServiceProvider.php23
-rw-r--r--infrastructure/Http/WebSocketController.php56
-rw-r--r--infrastructure/Validation/resources/lang/en/validation.php113
-rw-r--r--infrastructure/Version.php12
27 files changed, 0 insertions, 819 deletions
diff --git a/infrastructure/Api/Controllers/DefaultApiController.php b/infrastructure/Api/Controllers/DefaultApiController.php
deleted file mode 100644
index 1bb11bf..0000000
--- a/infrastructure/Api/Controllers/DefaultApiController.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-namespace Infrastructure\Api\Controllers;
-
-use Infrastructure\Http\Controller as BaseController;
-use Infrastructure\Version;
-
-class DefaultApiController extends BaseController
-{
- public function index()
- {
- return response()->json([
- 'message' => 'Welcome to the official Texx API'
- ]);
- }
-}
diff --git a/infrastructure/Api/routes_public.php b/infrastructure/Api/routes_public.php
deleted file mode 100644
index 3609ea8..0000000
--- a/infrastructure/Api/routes_public.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-
-$router->get('/', 'DefaultApiController@index'); \ No newline at end of file
diff --git a/infrastructure/Auth/AuthServiceProvider.php b/infrastructure/Auth/AuthServiceProvider.php
deleted file mode 100644
index 7f09b7d..0000000
--- a/infrastructure/Auth/AuthServiceProvider.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-namespace Infrastructure\Auth;
-
-use Carbon\Carbon;
-use Laravel\Passport\Passport;
-use Illuminate\Support\Facades\Gate;
-use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
-
-class AuthServiceProvider extends ServiceProvider
-{
- /**
- * The policy mappings for the application.
- *
- * @var array
- */
- protected $policies = [
- 'App\Model' => 'App\Policies\ModelPolicy',
- ];
-
- /**
- * Register any authentication / authorization services.
- *
- * @return void
- */
- public function boot()
- {
- $this->registerPolicies();
-
- Passport::routes(function ($router) {
- $router->forAccessTokens();
- // Uncomment for allowing personal access tokens
- // $router->forPersonalAccessTokens();
- $router->forTransientTokens();
- });
-
- Passport::tokensExpireIn(Carbon::now()->addYears(10));
-
- Passport::refreshTokensExpireIn(Carbon::now()->addDays(365));
- }
-} \ No newline at end of file
diff --git a/infrastructure/Auth/Controllers/LoginController.php b/infrastructure/Auth/Controllers/LoginController.php
deleted file mode 100644
index a72f8a0..0000000
--- a/infrastructure/Auth/Controllers/LoginController.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-namespace Infrastructure\Auth\Controllers;
-
-use Illuminate\Http\Request;
-use Infrastructure\Auth\LoginProxy;
-use Infrastructure\Auth\Requests\LoginRequest;
-use Infrastructure\Http\Controller;
-
-class LoginController extends Controller
-{
- private $loginProxy;
-
- public function __construct(LoginProxy $loginProxy)
- {
- $this->loginProxy = $loginProxy;
- }
-
- public function login(LoginRequest $request)
- {
- $email = $request->get('email');
- $password = $request->get('password');
-
- return $this->response($this->loginProxy->attemptLogin($email, $password));
- }
-
- public function refresh(Request $request)
- {
- return $this->response($this->loginProxy->attemptRefresh());
- }
-
- public function logout()
- {
- $this->loginProxy->logout();
-
- return $this->response(null, 204);
- }
-} \ No newline at end of file
diff --git a/infrastructure/Auth/Exceptions/InvalidCredentialsException.php b/infrastructure/Auth/Exceptions/InvalidCredentialsException.php
deleted file mode 100644
index 45a8b6e..0000000
--- a/infrastructure/Auth/Exceptions/InvalidCredentialsException.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-namespace Infrastructure\Auth\Exceptions;
-
-use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
-
-class InvalidCredentialsException extends UnauthorizedHttpException
-{
- public function __construct($message = null, \Exception $previous = null, $code = 0)
- {
- parent::__construct('', $message, $previous, $code);
- }
-} \ No newline at end of file
diff --git a/infrastructure/Auth/LoginProxy.php b/infrastructure/Auth/LoginProxy.php
deleted file mode 100644
index c245e52..0000000
--- a/infrastructure/Auth/LoginProxy.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-
-namespace Infrastructure\Auth;
-
-use Illuminate\Foundation\Application;
-use Infrastructure\Auth\Exceptions\InvalidCredentialsException;
-use Api\Users\Repositories\UserRepository;
-
-class LoginProxy
-{
- const REFRESH_TOKEN = 'refreshToken';
-
- private $apiConsumer;
-
- private $auth;
-
- private $cookie;
-
- private $db;
-
- private $request;
-
- private $userRepository;
-
- public function __construct(Application $app, UserRepository $userRepository)
- {
- $this->userRepository = $userRepository;
-
- $this->apiConsumer = $app->make('apiconsumer');
- $this->auth = $app->make('auth');
- $this->cookie = $app->make('cookie');
- $this->db = $app->make('db');
- $this->request = $app->make('request');
- }
-
- /**
- * Attempt to create an access token using user credentials
- *
- * @param string $email
- * @param string $password
- */
- public function attemptLogin($email, $password)
- {
- $user = $this->userRepository->getWhere('email', $email)->first();
-
- if (!is_null($user)) {
- $TokenObject = $this->proxy('password', [
- 'username' => $email,
- 'password' => $password
- ]);
- return array_merge($TokenObject, ['user_id' => $user->id]);
- }
-
-
- throw new InvalidCredentialsException();
- }
-
- /**
- * Attempt to refresh the access token used a refresh token that
- * has been saved in a cookie
- */
- public function attemptRefresh()
- {
- $refreshToken = $this->request->cookie(self::REFRESH_TOKEN);
-
- return $this->proxy('refresh_token', [
- 'refresh_token' => $refreshToken
- ]);
- }
-
- /**
- * Proxy a request to the OAuth server.
- *
- * @param string $grantType what type of grant type should be proxied
- * @param array $data the data to send to the server
- */
- public function proxy($grantType, array $data = [])
- {
- $data = array_merge($data, [
- 'client_id' => env('PASSWORD_CLIENT_ID'),
- 'client_secret' => env('PASSWORD_CLIENT_SECRET'),
- 'grant_type' => $grantType
- ]);
-
- $response = $this->apiConsumer->post('/oauth/token', $data);
-
- if (!$response->isSuccessful()) {
- throw new InvalidCredentialsException();
- }
-
- $data = json_decode($response->getContent());
-
- // Create a refresh token cookie
- $this->cookie->queue(
- self::REFRESH_TOKEN,
- $data->refresh_token,
- 864000, // 10 days
- null,
- null,
- false,
- true // HttpOnly
- );
-
- return [
- 'access_token' => $data->access_token,
- 'expires_in' => $data->expires_in
- ];
- }
-
- /**
- * Logs out the user. We revoke access token and refresh token.
- * Also instruct the client to forget the refresh cookie.
- */
- public function logout()
- {
- $accessToken = $this->auth->user()->token();
-
- $refreshToken = $this->db
- ->table('oauth_refresh_tokens')
- ->where('access_token_id', $accessToken->id)
- ->update([
- 'revoked' => true
- ]);
-
- $accessToken->revoke();
-
- $this->cookie->queue($this->cookie->forget(self::REFRESH_TOKEN));
- }
-}
diff --git a/infrastructure/Auth/Middleware/AccessTokenChecker.php b/infrastructure/Auth/Middleware/AccessTokenChecker.php
deleted file mode 100644
index f79f5cb..0000000
--- a/infrastructure/Auth/Middleware/AccessTokenChecker.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-namespace Infrastructure\Auth\Middleware;
-
-use Closure;
-use Illuminate\Foundation\Application;
-use Illuminate\Auth\Middleware\Authenticate;
-use Illuminate\Auth\AuthenticationException;
-use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
-
-class AccessTokenChecker
-{
- private $app;
-
- private $oAuthMiddleware;
-
- public function __construct(
- Application $app,
- Authenticate $authenticate
- ) {
- $this->app = $app;
- $this->authenticate = $authenticate;
- }
-
- public function handle($request, Closure $next, $scopesString = null)
- {
- if ($this->app->environment() !== 'testing') {
- try {
- return $this->authenticate->handle($request, $next, 'api');
- } catch (AuthenticationException $e) {
- throw new UnauthorizedHttpException('Challenge');
- }
- }
-
- return $next($request);
- }
-}
diff --git a/infrastructure/Auth/Requests/LoginRequest.php b/infrastructure/Auth/Requests/LoginRequest.php
deleted file mode 100644
index 5c5a3bb..0000000
--- a/infrastructure/Auth/Requests/LoginRequest.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-namespace Infrastructure\Auth\Requests;
-
-use Infrastructure\Http\ApiRequest;
-
-class LoginRequest extends ApiRequest
-{
- public function authorize()
- {
- return true;
- }
-
- public function rules()
- {
- return [
- 'email' => 'required|email',
- 'password' => 'required'
- ];
- }
-}
diff --git a/infrastructure/Auth/routes_protected.php b/infrastructure/Auth/routes_protected.php
deleted file mode 100644
index 0fe814f..0000000
--- a/infrastructure/Auth/routes_protected.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-
-$router->post('/logout', 'LoginController@logout'); \ No newline at end of file
diff --git a/infrastructure/Auth/routes_public.php b/infrastructure/Auth/routes_public.php
deleted file mode 100644
index 79f5b51..0000000
--- a/infrastructure/Auth/routes_public.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-
-$router->post('/login', 'LoginController@login');
-$router->post('/login/refresh', 'LoginController@refresh'); \ No newline at end of file
diff --git a/infrastructure/Console/Commands/StartServer.sh b/infrastructure/Console/Commands/StartServer.sh
deleted file mode 100644
index f9feaa8..0000000
--- a/infrastructure/Console/Commands/StartServer.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash -e
-redis-server &
-PIDS[0]=$!
-sudo php artisan serve --host 0.0.0.0 --port 80 &
-PIDS[1]=$!
-
-trap "sudo kill ${PIDS[*]}" SIGINT
-
-wait
diff --git a/infrastructure/Console/Commands/StartServerCommand.php b/infrastructure/Console/Commands/StartServerCommand.php
deleted file mode 100644
index 03ec6f9..0000000
--- a/infrastructure/Console/Commands/StartServerCommand.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-namespace Infrastructure\Console\Commands;
-
-use Illuminate\Console\Command;
-
-class StartServerCommand extends Command
-{
- /**
- * The console command name.
- *
- * @var string
- */
- protected $name = 'server';
-
- /**
- * Execute the console command.
- *
- * @return void
- */
- public function fire()
- {
- $this->line('Starting server...');
- if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
- exec("wsl bash infrastructure/Console/Commands/StartServer.sh");
- } else {
- exec("bash infrastructure/Console/Commands/StartServer.sh");
- }
- }
-} \ No newline at end of file
diff --git a/infrastructure/Console/Commands/WebSocketServerCommand.php b/infrastructure/Console/Commands/WebSocketServerCommand.php
deleted file mode 100644
index 764e16a..0000000
--- a/infrastructure/Console/Commands/WebSocketServerCommand.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-namespace Infrastructure\Console\Commands;
-
-use Illuminate\Console\Command;
-use Infrastructure\Http\WebSocketController;
-use Ratchet\Http\HttpServer;
-use Ratchet\Server\IoServer;
-use Ratchet\WebSocket\WsServer;
-
-class WebSocketServerCommand extends Command
-{
- /**
- * The console command name.
- *
- * @var string
- */
- protected $name = 'websocket';
-
- /**
- * Execute the console command.
- *
- * @return void
- */
- public function fire()
- {
- $server = IoServer::factory(
- new HttpServer(
- new WsServer(
- new WebSocketController()
- )
- ),
- 1337
- );
- $this->line('Starting websocket...');
- $server->run();
- }
-} \ No newline at end of file
diff --git a/infrastructure/Console/Kernel.php b/infrastructure/Console/Kernel.php
deleted file mode 100644
index 61173ff..0000000
--- a/infrastructure/Console/Kernel.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-namespace Infrastructure\Console;
-
-use Api\Users\Console\AddUserCommand;
-use Illuminate\Console\Scheduling\Schedule;
-use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
-
-class Kernel extends ConsoleKernel
-{
- /**
- * The Artisan commands provided by your application.
- *
- * @var array
- */
- protected $commands = [
- AddUserCommand::class,
- Commands\WebSocketServerCommand::class,
- Commands\StartServerCommand::class
- ];
-
- /**
- * Define the application's command schedule.
- *
- * @param \Illuminate\Console\Scheduling\Schedule $schedule
- * @return void
- */
- protected function schedule(Schedule $schedule)
- {
- // $schedule->command('inspire')
- // ->hourly();
- }
-}
diff --git a/infrastructure/Database/Eloquent/Model.php b/infrastructure/Database/Eloquent/Model.php
deleted file mode 100644
index a7781f7..0000000
--- a/infrastructure/Database/Eloquent/Model.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-namespace Infrastructure\Database\Eloquent;
-
-use Illuminate\Database\Eloquent\Model as BaseModel;
-
-abstract class Model extends BaseModel
-{
-}
diff --git a/infrastructure/Database/Eloquent/Repository.php b/infrastructure/Database/Eloquent/Repository.php
deleted file mode 100644
index a8b2c0b..0000000
--- a/infrastructure/Database/Eloquent/Repository.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-namespace Infrastructure\Database\Eloquent;
-
-use Optimus\Genie\Repository as BaseRepository;
-
-abstract class Repository extends BaseRepository
-{
-}
diff --git a/infrastructure/Events/Event.php b/infrastructure/Events/Event.php
deleted file mode 100644
index 2f19ea9..0000000
--- a/infrastructure/Events/Event.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-namespace Infrastructure\Events;
-
-abstract class Event
-{
- //
-}
diff --git a/infrastructure/Exceptions/Formatters/ExceptionFormatter.php b/infrastructure/Exceptions/Formatters/ExceptionFormatter.php
deleted file mode 100644
index 920ea69..0000000
--- a/infrastructure/Exceptions/Formatters/ExceptionFormatter.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-namespace Infrastructure\Exceptions\Formatters;
-
-use Exception;
-use Illuminate\Http\JsonResponse;
-use Optimus\Heimdal\Formatters\BaseFormatter;
-
-class ExceptionFormatter extends BaseFormatter
-{
- public function format(JsonResponse $response, Exception $e, array $reporterResponses)
- {
- $response->setStatusCode(500);
- $data = $response->getData(true);
-
- if ($this->debug) {
- $data = array_merge($data, [
- 'code' => $e->getCode(),
- 'message' => $e->getMessage(),
- 'exception' => (string)$e,
- 'line' => $e->getLine(),
- 'file' => $e->getFile()
- ]);
- } else {
- $data['message'] = $e->getMessage();
- }
-
- $response->setData($data);
- }
-}
diff --git a/infrastructure/Exceptions/Handler.php b/infrastructure/Exceptions/Handler.php
deleted file mode 100644
index af48a29..0000000
--- a/infrastructure/Exceptions/Handler.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-namespace Infrastructure\Exceptions;
-
-use Exception;
-use Illuminate\Validation\ValidationException;
-use Illuminate\Auth\Access\AuthorizationException;
-use Illuminate\Database\Eloquent\ModelNotFoundException;
-use Symfony\Component\HttpKernel\Exception\HttpException;
-use Optimus\Heimdal\ExceptionHandler;
-
-class Handler extends ExceptionHandler
-{
- /**
- * A list of the exception types that should not be reported.
- *
- * @var array
- */
- protected $dontReport = [
- AuthorizationException::class,
- HttpException::class,
- ModelNotFoundException::class,
- ValidationException::class,
- ];
-
- /**
- * Report or log an exception.
- *
- * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
- *
- * @param \Exception $e
- * @return void
- */
- public function report(Exception $e)
- {
- parent::report($e);
- }
-
- /**
- * Render an exception into an HTTP response.
- *
- * @param \Illuminate\Http\Request $request
- * @param \Exception $e
- * @return \Illuminate\Http\Response
- */
- public function render($request, Exception $e)
- {
- return parent::render($request, $e);
- }
-}
diff --git a/infrastructure/Http/ApiRequest.php b/infrastructure/Http/ApiRequest.php
deleted file mode 100644
index 0183bb4..0000000
--- a/infrastructure/Http/ApiRequest.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-namespace Infrastructure\Http;
-
-use Illuminate\Contracts\Validation\Validator;
-use Illuminate\Foundation\Http\FormRequest;
-use Symfony\Component\HttpKernel\Exception\HttpException;
-use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
-
-abstract class ApiRequest extends FormRequest
-{
- protected function failedValidation(Validator $validator)
- {
- throw new UnprocessableEntityHttpException($validator->errors()->toJson());
- }
-
- protected function failedAuthorization()
- {
- throw new HttpException(403);
- }
-}
diff --git a/infrastructure/Http/Controller.php b/infrastructure/Http/Controller.php
deleted file mode 100644
index aa567b9..0000000
--- a/infrastructure/Http/Controller.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-namespace Infrastructure\Http;
-
-use Illuminate\Foundation\Validation\ValidatesRequests;
-use Optimus\Bruno\LaravelController;
-
-abstract class Controller extends LaravelController
-{
-}
diff --git a/infrastructure/Http/Kernel.php b/infrastructure/Http/Kernel.php
deleted file mode 100644
index d74c8b3..0000000
--- a/infrastructure/Http/Kernel.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-namespace Infrastructure\Http;
-
-use Illuminate\Foundation\Http\Kernel as HttpKernel;
-
-class Kernel extends HttpKernel
-{
- /**
- * The application's global HTTP middleware stack.
- *
- * These middleware are run during every request to your application.
- *
- * @var array
- */
- protected $middleware = [
- \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
- \Infrastructure\Http\Middleware\EncryptCookies::class,
- \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
- \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
- ];
-
- /**
- * The application's route middleware groups.
- *
- * @var array
- */
- protected $middlewareGroups = [
-
- ];
-
- /**
- * The application's route middleware.
- *
- * These middleware may be assigned to groups or used individually.
- *
- * @var array
- */
- protected $routeMiddleware = [
- 'auth' => \Infrastructure\Auth\Middleware\AccessTokenChecker::class,
- 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
- 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
- 'can' => \Illuminate\Auth\Middleware\Authorize::class,
- 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
- 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
- ];
-}
diff --git a/infrastructure/Http/Middleware/EncryptCookies.php b/infrastructure/Http/Middleware/EncryptCookies.php
deleted file mode 100644
index 80b8da3..0000000
--- a/infrastructure/Http/Middleware/EncryptCookies.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-namespace Infrastructure\Http\Middleware;
-
-use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
-
-class EncryptCookies extends BaseEncrypter
-{
- /**
- * The names of the cookies that should not be encrypted.
- *
- * @var array
- */
- protected $except = [
- //
- ];
-}
diff --git a/infrastructure/Http/RouteServiceProvider.php b/infrastructure/Http/RouteServiceProvider.php
deleted file mode 100644
index a17d253..0000000
--- a/infrastructure/Http/RouteServiceProvider.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-namespace Infrastructure\Http;
-
-use Illuminate\Routing\Router;
-use Optimus\Api\System\RouteServiceProvider as ServiceProvider;
-
-class RouteServiceProvider extends ServiceProvider
-{
- /**
- * Define your route model bindings, pattern filters, etc.
- *
- * @return void
- */
- public function boot()
- {
- $router = $this->app->make(Router::class);
-
- $router->pattern('id', '[0-9]+');
-
- parent::boot($router);
- }
-}
diff --git a/infrastructure/Http/WebSocketController.php b/infrastructure/Http/WebSocketController.php
deleted file mode 100644
index 19e0868..0000000
--- a/infrastructure/Http/WebSocketController.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-namespace Infrastructure\Http;
-
-use Ratchet\ConnectionInterface;
-use Ratchet\MessageComponentInterface;
-
-class WebSocketController extends Controller implements MessageComponentInterface
-{
- private $connections = [];
-
- /**
- * When a new connection is opened it will be passed to this method
- * @param ConnectionInterface $conn The socket/connection that just connected to your application
- * @throws \Exception
- */
- function onOpen(ConnectionInterface $conn)
- {
- $this->connections[$conn->resourceId] = compact('conn') + ['user_id' => null];
- }
-
- /**
- * This is called before or after a socket is closed (depends on how it's closed). SendMessage to $conn will not result in an error if it has already been closed.
- * @param ConnectionInterface $conn The socket/connection that is closing/closed
- * @throws \Exception
- */
- function onClose(ConnectionInterface $conn)
- {
- $disconnectedId = $conn->resourceId;
- unset($this->connections[$disconnectedId]);
- }
-
- /**
- * If there is an error with one of the sockets, or somewhere in the application where an Exception is thrown,
- * the Exception is sent back down the stack, handled by the Server and bubbled back up the application through this method
- * @param ConnectionInterface $conn
- * @param \Exception $e
- * @throws \Exception
- */
- function onError(ConnectionInterface $conn, \Exception $e)
- {
- unset($this->connections[$conn->resourceId]);
- $conn->close();
- }
-
- /**
- * Triggered when a client sends data through the socket
- * @param \Ratchet\ConnectionInterface $conn The socket/connection that sent the message to your application
- * @param string $msg The message received
- * @throws \Exception
- */
- function onMessage(ConnectionInterface $conn, $msg)
- {
-
- }
-} \ No newline at end of file
diff --git a/infrastructure/Validation/resources/lang/en/validation.php b/infrastructure/Validation/resources/lang/en/validation.php
deleted file mode 100644
index 208281b..0000000
--- a/infrastructure/Validation/resources/lang/en/validation.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-return [
-
- /*
- |--------------------------------------------------------------------------
- | Validation Language Lines
- |--------------------------------------------------------------------------
- |
- | The following language lines contain the default error messages used by
- | the validator class. Some of these rules have multiple versions such
- | as the size rules. Feel free to tweak each of these messages here.
- |
- */
-
- 'accepted' => 'The :attribute must be accepted.',
- 'active_url' => 'The :attribute is not a valid URL.',
- 'after' => 'The :attribute must be a date after :date.',
- 'alpha' => 'The :attribute may only contain letters.',
- 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
- 'alpha_num' => 'The :attribute may only contain letters and numbers.',
- 'array' => 'The :attribute must be an array.',
- 'before' => 'The :attribute must be a date before :date.',
- 'between' => [
- 'numeric' => 'The :attribute must be between :min and :max.',
- 'file' => 'The :attribute must be between :min and :max kilobytes.',
- 'string' => 'The :attribute must be between :min and :max characters.',
- 'array' => 'The :attribute must have between :min and :max items.',
- ],
- 'boolean' => 'The :attribute must be true or false.',
- 'confirmed' => 'The :attribute confirmation does not match.',
- 'date' => 'The :attribute is not a valid date.',
- 'date_format' => 'The :attribute does not match the format :format.',
- 'different' => 'The :attribute and :other must be different.',
- 'digits' => 'The :attribute must be :digits digits.',
- 'digits_between' => 'The :attribute must be between :min and :max digits.',
- 'distinct' => 'The :attribute has a duplicate value.',
- 'email' => 'The :attribute must be a valid email address.',
- 'exists' => 'The selected :attribute is invalid.',
- 'filled' => 'The :attribute is required.',
- 'image' => 'The :attribute must be an image.',
- 'in' => 'The selected :attribute is invalid.',
- 'in_array' => 'The :attribute does not exist in :other.',
- 'integer' => 'The :attribute must be an integer.',
- 'ip' => 'The :attribute must be a valid IP address.',
- 'json' => 'The :attribute must be a valid JSON string.',
- 'max' => [
- 'numeric' => 'The :attribute may not be greater than :max.',
- 'file' => 'The :attribute may not be greater than :max kilobytes.',
- 'string' => 'The :attribute may not be greater than :max characters.',
- 'array' => 'The :attribute may not have more than :max items.',
- ],
- 'mimes' => 'The :attribute must be a file of type: :values.',
- 'min' => [
- 'numeric' => 'The :attribute must be at least :min.',
- 'file' => 'The :attribute must be at least :min kilobytes.',
- 'string' => 'The :attribute must be at least :min characters.',
- 'array' => 'The :attribute must have at least :min items.',
- ],
- 'not_in' => 'The selected :attribute is invalid.',
- 'numeric' => 'The :attribute must be a number.',
- 'present' => 'The :attribute must be present.',
- 'regex' => 'The :attribute format is invalid.',
- 'required' => 'The :attribute is required.',
- 'required_if' => 'The :attribute is required when :other is :value.',
- 'required_unless' => 'The :attribute is required unless :other is in :values.',
- 'required_with' => 'The :attribute is required when :values is present.',
- 'required_with_all' => 'The :attribute is required when :values is present.',
- 'required_without' => 'The :attribute is required when :values is not present.',
- 'required_without_all' => 'The :attribute is required when none of :values are present.',
- 'same' => 'The :attribute and :other must match.',
- 'size' => [
- 'numeric' => 'The :attribute must be :size.',
- 'file' => 'The :attribute must be :size kilobytes.',
- 'string' => 'The :attribute must be :size characters.',
- 'array' => 'The :attribute must contain :size items.',
- ],
- 'string' => 'The :attribute must be a string.',
- 'timezone' => 'The :attribute must be a valid zone.',
- 'unique' => 'The :attribute has already been taken.',
- 'url' => 'The :attribute format is invalid.',
-
- /*
- |--------------------------------------------------------------------------
- | Custom Validation Language Lines
- |--------------------------------------------------------------------------
- |
- | Here you may specify custom validation messages for attributes using the
- | convention "attribute.rule" to name the lines. This makes it quick to
- | specify a specific custom language line for a given attribute rule.
- |
- */
-
- 'custom' => [
- 'attribute-name' => [
- 'rule-name' => 'custom-message',
- ],
- ],
-
- /*
- |--------------------------------------------------------------------------
- | Custom Validation Attributes
- |--------------------------------------------------------------------------
- |
- | The following language lines are used to swap attribute place-holders
- | with something more reader friendly such as E-Mail Address instead
- | of "email". This simply helps us make messages a little cleaner.
- |
- */
-
- 'attributes' => [],
-
-];
diff --git a/infrastructure/Version.php b/infrastructure/Version.php
deleted file mode 100644
index 9ca7941..0000000
--- a/infrastructure/Version.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-namespace Infrastructure;
-
-class Version
-{
- public static function getGitTag()
- {
- $versionFile = base_path('version.txt');
- return file_exists($versionFile) ? file_get_contents($versionFile) : exec('git describe --tags');
- }
-}