From 42a89b4b594373b297970676f041ad682b7df84d Mon Sep 17 00:00:00 2001 From: Diego Quintale Date: Fri, 14 Sep 2018 13:31:36 -0300 Subject: [PATCH] Install Laravel Helper --- app/Providers/AuthServiceProvider.php | 2 + app/Providers/RouteServiceProvider.php | 2 + composer.json | 1 + composer.lock | 971 +++++++++++++++++- config/auth.php | 9 +- database/factories/EngineRegistryFactory.php | 16 + .../factories/EngineVirtualEntityFactory.php | 15 + .../EngineVirtualEntityTypeFactory.php | 9 + database/factories/TenantFactory.php | 12 + ...2018_04_12_000000_create_tenants_table.php | 34 + ..._000001_create_engine_registries_table.php | 43 + ...eate_engine_virtual_entity_types_table.php | 32 + ...4_create_engine_virtual_entities_table.php | 46 + database/seeds/DatabaseTimestamps.php | 13 + .../seeds/EngineVirtualEntityTypeSeeder.php | 20 + routes/base.php | 10 + 16 files changed, 1191 insertions(+), 44 deletions(-) create mode 100644 database/factories/EngineRegistryFactory.php create mode 100644 database/factories/EngineVirtualEntityFactory.php create mode 100644 database/factories/EngineVirtualEntityTypeFactory.php create mode 100644 database/factories/TenantFactory.php create mode 100644 database/migrations/2018_04_12_000000_create_tenants_table.php create mode 100644 database/migrations/2018_04_12_000001_create_engine_registries_table.php create mode 100644 database/migrations/2018_04_12_000003_create_engine_virtual_entity_types_table.php create mode 100644 database/migrations/2018_04_12_000004_create_engine_virtual_entities_table.php create mode 100644 database/seeds/DatabaseTimestamps.php create mode 100644 database/seeds/EngineVirtualEntityTypeSeeder.php create mode 100644 routes/base.php diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 9784b1a..fdd524c 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -25,6 +25,8 @@ public function boot() { $this->registerPolicies(); + \Laravel\Passport\Passport::routes(); + // } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 5ea48d3..c01d2e6 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -39,6 +39,8 @@ public function map() $this->mapWebRoutes(); + \Betalabs\LaravelHelper\LaravelHelper::routes(); + // } diff --git a/composer.json b/composer.json index 3cb9426..4c86701 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "type": "project", "require": { "php": "^7.1.3", + "betalabs/engine-laravel-helper": "^0.4.1", "fideloper/proxy": "^4.0", "laravel/framework": "5.7.*", "laravel/tinker": "^1.0" diff --git a/composer.lock b/composer.lock index 3631ff9..2498cb7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,120 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "66ca7343889332c2b8ecca11c251430c", + "content-hash": "5b562de097f73dd7b152388afe488b18", "packages": [ + { + "name": "betalabs/engine-laravel-helper", + "version": "v0.4.1", + "source": { + "type": "git", + "url": "https://github.com/Betalabs/engine-laravel-helper.git", + "reference": "9b0fe52841eeb8af3bc0c196fc0b738a941a3d9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Betalabs/engine-laravel-helper/zipball/9b0fe52841eeb8af3bc0c196fc0b738a941a3d9a", + "reference": "9b0fe52841eeb8af3bc0c196fc0b738a941a3d9a", + "shasum": "" + }, + "require": { + "laravel/passport": "^6.0", + "myclabs/php-enum": "^1.5", + "php": ">=7.1.3" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "orchestra/testbench": "~3.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Betalabs\\LaravelHelper\\LaravelHelperServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Betalabs\\LaravelHelper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Betalabs Tecnologia LTDA.", + "email": "betalabs@betalabs.com.br" + } + ], + "description": "Engine Laravel Helper provides essential functionalities to work with Engine apps on Laravel.", + "time": "2018-07-30T17:32:26+00:00" + }, + { + "name": "defuse/php-encryption", + "version": "v2.2.1", + "source": { + "type": "git", + "url": "https://github.com/defuse/php-encryption.git", + "reference": "0f407c43b953d571421e0020ba92082ed5fb7620" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/defuse/php-encryption/zipball/0f407c43b953d571421e0020ba92082ed5fb7620", + "reference": "0f407c43b953d571421e0020ba92082ed5fb7620", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "paragonie/random_compat": ">= 2", + "php": ">=5.4.0" + }, + "require-dev": { + "nikic/php-parser": "^2.0|^3.0|^4.0", + "phpunit/phpunit": "^4|^5" + }, + "bin": [ + "bin/generate-defuse-key" + ], + "type": "library", + "autoload": { + "psr-4": { + "Defuse\\Crypto\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Hornby", + "email": "taylor@defuse.ca", + "homepage": "https://defuse.ca/" + }, + { + "name": "Scott Arciszewski", + "email": "info@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "Secure PHP Encryption Library", + "keywords": [ + "aes", + "authenticated encryption", + "cipher", + "crypto", + "cryptography", + "encrypt", + "encryption", + "openssl", + "security", + "symmetric key cryptography" + ], + "time": "2018-07-24T23:27:56+00:00" + }, { "name": "dnoegel/php-xdg-base-dir", "version": "0.1", @@ -366,6 +478,233 @@ ], "time": "2018-02-07T20:20:57+00:00" }, + { + "name": "firebase/php-jwt", + "version": "v5.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/9984a4d3a32ae7673d6971ea00bae9d0a1abba0e", + "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": " 4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2017-06-27T22:17:23+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20T17:10:46+00:00" + }, { "name": "jakub-onderka/php-console-color", "version": "0.1", @@ -586,56 +925,234 @@ "email": "taylor@laravel.com" } ], - "description": "The Laravel Framework.", - "homepage": "https://laravel.com", + "description": "The Laravel Framework.", + "homepage": "https://laravel.com", + "keywords": [ + "framework", + "laravel" + ], + "time": "2018-09-11T13:42:55+00:00" + }, + { + "name": "laravel/passport", + "version": "v6.0.7", + "source": { + "type": "git", + "url": "https://github.com/laravel/passport.git", + "reference": "5a3dbeb0904573fcfecf11c018eaa42bfc935372" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/passport/zipball/5a3dbeb0904573fcfecf11c018eaa42bfc935372", + "reference": "5a3dbeb0904573fcfecf11c018eaa42bfc935372", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~3.0|~4.0|~5.0", + "guzzlehttp/guzzle": "~6.0", + "illuminate/auth": "~5.6", + "illuminate/console": "~5.6", + "illuminate/container": "~5.6", + "illuminate/contracts": "~5.6", + "illuminate/database": "~5.6", + "illuminate/encryption": "~5.6", + "illuminate/http": "~5.6", + "illuminate/support": "~5.6", + "league/oauth2-server": "^7.0", + "php": ">=7.1", + "phpseclib/phpseclib": "^2.0", + "symfony/psr-http-message-bridge": "~1.0", + "zendframework/zend-diactoros": "~1.0" + }, + "require-dev": { + "mockery/mockery": "~1.0", + "phpunit/phpunit": "~6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.0-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Passport\\PassportServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Passport\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Laravel Passport provides OAuth2 server support to Laravel.", + "keywords": [ + "laravel", + "oauth", + "passport" + ], + "time": "2018-08-09T19:10:08+00:00" + }, + { + "name": "laravel/tinker", + "version": "v1.0.7", + "source": { + "type": "git", + "url": "https://github.com/laravel/tinker.git", + "reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/tinker/zipball/e3086ee8cb1f54a39ae8dcb72d1c37d10128997d", + "reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d", + "shasum": "" + }, + "require": { + "illuminate/console": "~5.1", + "illuminate/contracts": "~5.1", + "illuminate/support": "~5.1", + "php": ">=5.5.9", + "psy/psysh": "0.7.*|0.8.*|0.9.*", + "symfony/var-dumper": "~3.0|~4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "suggest": { + "illuminate/database": "The Illuminate Database package (~5.1)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Tinker\\TinkerServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Tinker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Powerful REPL for the Laravel framework.", + "keywords": [ + "REPL", + "Tinker", + "laravel", + "psysh" + ], + "time": "2018-05-17T13:42:07+00:00" + }, + { + "name": "lcobucci/jwt", + "version": "3.2.4", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "c9704b751315d21735dc98d78d4f37bd73596da7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/c9704b751315d21735dc98d78d4f37bd73596da7", + "reference": "c9704b751315d21735dc98d78d4f37bd73596da7", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "php": ">=5.5" + }, + "require-dev": { + "mdanter/ecc": "~0.3.1", + "mikey179/vfsstream": "~1.5", + "phpmd/phpmd": "~2.2", + "phpunit/php-invoker": "~1.1", + "phpunit/phpunit": "~4.5", + "squizlabs/php_codesniffer": "~2.3" + }, + "suggest": { + "mdanter/ecc": "Required to use Elliptic Curves based algorithms." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", "keywords": [ - "framework", - "laravel" + "JWS", + "jwt" ], - "time": "2018-09-11T13:42:55+00:00" + "time": "2018-08-03T11:23:50+00:00" }, { - "name": "laravel/tinker", - "version": "v1.0.7", + "name": "league/event", + "version": "2.1.2", "source": { "type": "git", - "url": "https://github.com/laravel/tinker.git", - "reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d" + "url": "https://github.com/thephpleague/event.git", + "reference": "e4bfc88dbcb60c8d8a2939a71f9813e141bbe4cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/e3086ee8cb1f54a39ae8dcb72d1c37d10128997d", - "reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d", + "url": "https://api.github.com/repos/thephpleague/event/zipball/e4bfc88dbcb60c8d8a2939a71f9813e141bbe4cd", + "reference": "e4bfc88dbcb60c8d8a2939a71f9813e141bbe4cd", "shasum": "" }, "require": { - "illuminate/console": "~5.1", - "illuminate/contracts": "~5.1", - "illuminate/support": "~5.1", - "php": ">=5.5.9", - "psy/psysh": "0.7.*|0.8.*|0.9.*", - "symfony/var-dumper": "~3.0|~4.0" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "suggest": { - "illuminate/database": "The Illuminate Database package (~5.1)." + "henrikbjorn/phpspec-code-coverage": "~1.0.1", + "phpspec/phpspec": "~2.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" - }, - "laravel": { - "providers": [ - "Laravel\\Tinker\\TinkerServiceProvider" - ] + "dev-master": "2.2-dev" } }, "autoload": { "psr-4": { - "Laravel\\Tinker\\": "src/" + "League\\Event\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -644,18 +1161,17 @@ ], "authors": [ { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" + "name": "Frank de Jonge", + "email": "info@frenky.net" } ], - "description": "Powerful REPL for the Laravel framework.", + "description": "Event package", "keywords": [ - "REPL", - "Tinker", - "laravel", - "psysh" + "emitter", + "event", + "listener" ], - "time": "2018-05-17T13:42:07+00:00" + "time": "2015-05-21T12:24:47+00:00" }, { "name": "league/flysystem", @@ -741,6 +1257,76 @@ ], "time": "2018-08-22T07:45:22+00:00" }, + { + "name": "league/oauth2-server", + "version": "7.2.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/oauth2-server.git", + "reference": "8184f771d43ea7305ddbb893d0daf6f0352ec5fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/oauth2-server/zipball/8184f771d43ea7305ddbb893d0daf6f0352ec5fd", + "reference": "8184f771d43ea7305ddbb893d0daf6f0352ec5fd", + "shasum": "" + }, + "require": { + "defuse/php-encryption": "^2.1", + "ext-openssl": "*", + "lcobucci/jwt": "^3.2.2", + "league/event": "^2.1", + "php": ">=7.0.0", + "psr/http-message": "^1.0.1" + }, + "replace": { + "league/oauth2server": "*", + "lncd/oauth2": "*" + }, + "require-dev": { + "phpstan/phpstan": "^0.9.2", + "phpstan/phpstan-phpunit": "^0.9.4", + "phpstan/phpstan-strict-rules": "^0.9.0", + "phpunit/phpunit": "^6.3 || ^7.0", + "zendframework/zend-diactoros": "^1.3.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\OAuth2\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alex Bilbie", + "email": "hello@alexbilbie.com", + "homepage": "http://www.alexbilbie.com", + "role": "Developer" + } + ], + "description": "A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.", + "homepage": "https://oauth2.thephpleague.com/", + "keywords": [ + "Authentication", + "api", + "auth", + "authorisation", + "authorization", + "oauth", + "oauth 2", + "oauth 2.0", + "oauth2", + "protect", + "resource", + "secure", + "server" + ], + "time": "2018-06-23T16:57:59+00:00" + }, { "name": "monolog/monolog", "version": "1.23.0", @@ -819,6 +1405,50 @@ ], "time": "2017-06-19T01:22:40+00:00" }, + { + "name": "myclabs/php-enum", + "version": "1.6.2", + "source": { + "type": "git", + "url": "https://github.com/myclabs/php-enum.git", + "reference": "ca2f4090a7ecae6f0c67fc9bd07cfb51cdf04219" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/php-enum/zipball/ca2f4090a7ecae6f0c67fc9bd07cfb51cdf04219", + "reference": "ca2f4090a7ecae6f0c67fc9bd07cfb51cdf04219", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.7|^6.0", + "squizlabs/php_codesniffer": "1.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "MyCLabs\\Enum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP Enum contributors", + "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" + } + ], + "description": "PHP Enum implementation", + "homepage": "http://github.com/myclabs/php-enum", + "keywords": [ + "enum" + ], + "time": "2018-08-01T21:05:54+00:00" + }, { "name": "nesbot/carbon", "version": "1.33.0", @@ -970,6 +1600,98 @@ ], "time": "2018-07-02T15:55:56+00:00" }, + { + "name": "phpseclib/phpseclib", + "version": "2.0.11", + "source": { + "type": "git", + "url": "https://github.com/phpseclib/phpseclib.git", + "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7053f06f91b3de78e143d430e55a8f7889efc08b", + "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phing/phing": "~2.7", + "phpunit/phpunit": "^4.8.35|^5.7|^6.0", + "sami/sami": "~2.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "suggest": { + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", + "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", + "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." + }, + "type": "library", + "autoload": { + "files": [ + "phpseclib/bootstrap.php" + ], + "psr-4": { + "phpseclib\\": "phpseclib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Wigginton", + "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", + "role": "Developer" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "role": "Developer" + } + ], + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", + "homepage": "http://phpseclib.sourceforge.net", + "keywords": [ + "BigInteger", + "aes", + "asn.1", + "asn1", + "blowfish", + "crypto", + "cryptography", + "encryption", + "rsa", + "security", + "sftp", + "signature", + "signing", + "ssh", + "twofish", + "x.509", + "x509" + ], + "time": "2018-04-15T16:55:05+00:00" + }, { "name": "psr/container", "version": "1.0.0", @@ -1019,6 +1741,56 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, { "name": "psr/log", "version": "1.0.2", @@ -1980,6 +2752,67 @@ "homepage": "https://symfony.com", "time": "2018-08-03T11:13:38+00:00" }, + { + "name": "symfony/psr-http-message-bridge", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/psr-http-message-bridge.git", + "reference": "53c15a6a7918e6c2ab16ae370ea607fb40cab196" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/53c15a6a7918e6c2ab16ae370ea607fb40cab196", + "reference": "53c15a6a7918e6c2ab16ae370ea607fb40cab196", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "psr/http-message": "^1.0", + "symfony/http-foundation": "^2.3.42 || ^3.4 || ^4.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.4 || 4.0" + }, + "suggest": { + "psr/http-factory-implementation": "To use the PSR-17 factory", + "psr/http-message-implementation": "To use the HttpFoundation factory", + "zendframework/zend-diactoros": "To use the Zend Diactoros factory" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\PsrHttpMessage\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "PSR HTTP message bridge", + "homepage": "http://symfony.com", + "keywords": [ + "http", + "http-message", + "psr-7" + ], + "time": "2018-08-30T16:28:28+00:00" + }, { "name": "symfony/routing", "version": "v4.1.4", @@ -2297,6 +3130,70 @@ "environment" ], "time": "2018-07-29T20:33:41+00:00" + }, + { + "name": "zendframework/zend-diactoros", + "version": "1.8.6", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-diactoros.git", + "reference": "20da13beba0dde8fb648be3cc19765732790f46e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/20da13beba0dde8fb648be3cc19765732790f46e", + "reference": "20da13beba0dde8fb648be3cc19765732790f46e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-dom": "*", + "ext-libxml": "*", + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7", + "zendframework/zend-coding-standard": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev", + "dev-develop": "1.9.x-dev", + "dev-release-2.0": "2.0.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php" + ], + "psr-4": { + "Zend\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://github.com/zendframework/zend-diactoros", + "keywords": [ + "http", + "psr", + "psr-7" + ], + "time": "2018-09-05T19:29:37+00:00" } ], "packages-dev": [ diff --git a/config/auth.php b/config/auth.php index 7817501..d070345 100644 --- a/config/auth.php +++ b/config/auth.php @@ -42,7 +42,7 @@ ], 'api' => [ - 'driver' => 'token', + 'driver' => 'passport', 'provider' => 'users', ], ], @@ -67,13 +67,8 @@ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => App\User::class, + 'model' => \Betalabs\LaravelHelper\Models\Tenant::class, ], - - // 'users' => [ - // 'driver' => 'database', - // 'table' => 'users', - // ], ], /* diff --git a/database/factories/EngineRegistryFactory.php b/database/factories/EngineRegistryFactory.php new file mode 100644 index 0000000..60c3a5c --- /dev/null +++ b/database/factories/EngineRegistryFactory.php @@ -0,0 +1,16 @@ +define(\Betalabs\LaravelHelper\Models\EngineRegistry::class, + function (Faker $faker) { + static $tenant; + + return [ + 'tenant_id' => $tenant, + 'registry_id' => $faker->randomNumber(), + 'api_base_uri' => $faker->url, + 'api_access_token' => $faker->text + ]; + } +); diff --git a/database/factories/EngineVirtualEntityFactory.php b/database/factories/EngineVirtualEntityFactory.php new file mode 100644 index 0000000..0326cba --- /dev/null +++ b/database/factories/EngineVirtualEntityFactory.php @@ -0,0 +1,15 @@ +define(\Betalabs\LaravelHelper\Models\EngineVirtualEntity::class, function (Faker $faker) { + static $tenant; + + return [ + 'tenant_id' => $tenant, + 'code' => $faker->randomNumber(), + 'type_id' => function () { + return factory(\Betalabs\LaravelHelper\Models\EngineVirtualEntityType::class)->create()->id; + } + ]; +}); diff --git a/database/factories/EngineVirtualEntityTypeFactory.php b/database/factories/EngineVirtualEntityTypeFactory.php new file mode 100644 index 0000000..833542d --- /dev/null +++ b/database/factories/EngineVirtualEntityTypeFactory.php @@ -0,0 +1,9 @@ +define(\Betalabs\LaravelHelper\Models\EngineVirtualEntityType::class, function (Faker $faker) { + return [ + 'name' => $faker->name + ]; +}); diff --git a/database/factories/TenantFactory.php b/database/factories/TenantFactory.php new file mode 100644 index 0000000..9ade64d --- /dev/null +++ b/database/factories/TenantFactory.php @@ -0,0 +1,12 @@ +define(\Betalabs\LaravelHelper\Models\Tenant::class, + function (Faker $faker) { + return [ + 'name' => $faker->name, + 'email' => $faker->companyEmail, + ]; + } +); diff --git a/database/migrations/2018_04_12_000000_create_tenants_table.php b/database/migrations/2018_04_12_000000_create_tenants_table.php new file mode 100644 index 0000000..85b5b72 --- /dev/null +++ b/database/migrations/2018_04_12_000000_create_tenants_table.php @@ -0,0 +1,34 @@ +increments('id'); + $table->string('name'); + $table->string('email')->index(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('tenants'); + } +} diff --git a/database/migrations/2018_04_12_000001_create_engine_registries_table.php b/database/migrations/2018_04_12_000001_create_engine_registries_table.php new file mode 100644 index 0000000..3d22549 --- /dev/null +++ b/database/migrations/2018_04_12_000001_create_engine_registries_table.php @@ -0,0 +1,43 @@ +increments('id'); + $table->unsignedInteger('tenant_id'); + $table->unsignedInteger('registry_id'); + $table->string('api_base_uri'); + $table->text('api_access_token'); + $table->timestamps(); + + $table->foreign('tenant_id') + ->references('id') + ->on('tenants'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('engine_registries', function (Blueprint $table) { + $table->dropForeign(['tenant_id']); + }); + + Schema::dropIfExists('engine_registries'); + } +} diff --git a/database/migrations/2018_04_12_000003_create_engine_virtual_entity_types_table.php b/database/migrations/2018_04_12_000003_create_engine_virtual_entity_types_table.php new file mode 100644 index 0000000..1e142f1 --- /dev/null +++ b/database/migrations/2018_04_12_000003_create_engine_virtual_entity_types_table.php @@ -0,0 +1,32 @@ +increments('id'); + $table->string('name'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('engine_virtual_entity_types'); + } +} diff --git a/database/migrations/2018_04_12_000004_create_engine_virtual_entities_table.php b/database/migrations/2018_04_12_000004_create_engine_virtual_entities_table.php new file mode 100644 index 0000000..1640ae9 --- /dev/null +++ b/database/migrations/2018_04_12_000004_create_engine_virtual_entities_table.php @@ -0,0 +1,46 @@ +increments('id'); + $table->unsignedInteger('tenant_id'); + $table->string('code')->index(); + $table->unsignedInteger('type_id'); + $table->timestamps(); + + $table->foreign('tenant_id') + ->references('id') + ->on('tenants'); + $table->foreign('type_id') + ->references('id') + ->on('engine_virtual_entity_types'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('engine_virtual_entities', function (Blueprint $table) { + $table->dropForeign(['tenant_id']); + $table->dropForeign(['type_id']); + }); + + Schema::dropIfExists('engine_virtual_entities'); + } +} diff --git a/database/seeds/DatabaseTimestamps.php b/database/seeds/DatabaseTimestamps.php new file mode 100644 index 0000000..967187e --- /dev/null +++ b/database/seeds/DatabaseTimestamps.php @@ -0,0 +1,13 @@ + \Carbon\Carbon::now(), + 'updated_at' => \Carbon\Carbon::now() + ]; + } +} \ No newline at end of file diff --git a/database/seeds/EngineVirtualEntityTypeSeeder.php b/database/seeds/EngineVirtualEntityTypeSeeder.php new file mode 100644 index 0000000..e3de5d8 --- /dev/null +++ b/database/seeds/EngineVirtualEntityTypeSeeder.php @@ -0,0 +1,20 @@ +insert(array_merge(['id' => 1, 'name' => 'Product'], $this->timestamps())); + DB::table('engine_virtual_entity_types')->insert(array_merge(['id' => 2, 'name' => 'Shipping company'], $this->timestamps())); + } +} diff --git a/routes/base.php b/routes/base.php new file mode 100644 index 0000000..9fbb2a2 --- /dev/null +++ b/routes/base.php @@ -0,0 +1,10 @@ +group(function () { + Route::get('/tenants', 'TenantController@show'); + Route::put('/tenants', 'TenantController@update'); +}); + +Route::post('/apps/genesis', 'AppController@register');