From 5866521e83163b1a5cc6789c3288a43f47b00774 Mon Sep 17 00:00:00 2001 From: akbarjimi Date: Tue, 2 Mar 2021 16:15:03 +0330 Subject: [PATCH] Yet another quality commit. --- app/Models/Activity.php | 6 +- app/Models/Business.php | 2 +- app/Models/Cost.php | 2 +- app/Models/File.php | 2 +- app/Models/Fingerprint.php | 2 +- app/Models/Project.php | 2 +- app/Models/SoftDeletes.php | 2 +- app/Models/Sprint.php | 2 +- app/Models/Status.php | 2 +- app/Models/System.php | 2 +- app/Models/Tag.php | 2 +- app/Models/TagTask.php | 4 +- app/Models/Transaction.php | 2 +- app/Models/User.php | 2 +- app/Models/Workflow.php | 2 +- app/Scopes/BusinessScope.php | 18 -- app/Statists/Pipe.php | 8 - app/Statists/SprintStatist.php | 44 --- app/Statists/SystemStatist.php | 22 -- app/Statists/TagStatist.php | 54 ---- app/Utilities/Exceptions/Handler.php | 2 +- app/Utilities/Jobs/AsyncCall.php | 42 ++- app/Utilities/Logger/CreateCustomLogger.php | 2 +- .../Logger/LogServiceRecordProcessor.php | 2 +- .../Middlewares/BindBusinessInfo.php | 23 +- app/Utilities/Models/Model.php | 2 +- app/Utilities/Models/ReportableRelation.php | 2 +- .../Providers/AuthServiceProvider.php | 55 +++- .../Providers/HiLibraryServiceProvider.php | 2 +- composer.json | 32 ++- composer.lock | 259 +++--------------- config.default/app.php | 232 ---------------- config.default/filesystems.php | 72 ----- config.default/logging.php | 104 ------- config.default/services.php | 33 --- config/amqp.php | 73 ----- config/app.php | 93 ++++++- {config.default => config}/auth.php | 0 {config.default => config}/broadcasting.php | 0 {config.default => config}/cache.php | 0 config/cors.php | 43 +-- config/cors.php.laravel | 59 ++++ .../cors.php => config/cors.php.lumen | 0 {config.default => config}/database.php | 0 {config.default => config}/hashing.php | 0 config/logging.php | 2 +- {config.default => config}/mail.php | 0 {config.default => config}/queue.php | 0 {config.default => config}/session.php | 0 {config.default => config}/view.php | 0 definitions.json | 152 ++++++++++ docker-compose.yml | 24 +- routes/api.php | 16 +- 53 files changed, 534 insertions(+), 974 deletions(-) delete mode 100644 app/Scopes/BusinessScope.php delete mode 100644 app/Statists/Pipe.php delete mode 100644 app/Statists/SprintStatist.php delete mode 100644 app/Statists/SystemStatist.php delete mode 100644 app/Statists/TagStatist.php delete mode 100644 config.default/app.php delete mode 100644 config.default/filesystems.php delete mode 100644 config.default/logging.php delete mode 100644 config.default/services.php delete mode 100644 config/amqp.php rename {config.default => config}/auth.php (100%) rename {config.default => config}/broadcasting.php (100%) rename {config.default => config}/cache.php (100%) create mode 100644 config/cors.php.laravel rename config.default/cors.php => config/cors.php.lumen (100%) rename {config.default => config}/database.php (100%) rename {config.default => config}/hashing.php (100%) rename {config.default => config}/mail.php (100%) rename {config.default => config}/queue.php (100%) rename {config.default => config}/session.php (100%) rename {config.default => config}/view.php (100%) create mode 100644 definitions.json diff --git a/app/Models/Activity.php b/app/Models/Activity.php index cf4c1d1..29e7ef2 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -1,10 +1,10 @@ where('business_id', '=', request('business_id')); - } -} diff --git a/app/Statists/Pipe.php b/app/Statists/Pipe.php deleted file mode 100644 index cf1ca1c..0000000 --- a/app/Statists/Pipe.php +++ /dev/null @@ -1,8 +0,0 @@ -task = $task; - } - - public function handle(&$result, $next) - { - $key = 'sprints.'; - $key .= ($this->task->sprint_id ?? 0).'.'; - $key .= ($this->task->assignee_id ?? 0).'.'; - $key .= $this->task->workflow_id . '.'; - $key .= $this->task->status_id; - - $map = [ - 'total' => 0, - 'test' => 0, - 'overdue' => 0, - 'worked' => 0, // total worked in minute - 'estimate' => 0, // estimate total - ]; - - $node = Arr::get($result, $key, $map); - - $node['total'] = $node['total'] + 1; - $node['test'] = $node['test'] + $result->ready_to_test; - $node['overdue'] = $node['overdue'] + ($result->on_time? 0 : 1); - - Arr::set($result, $key, $node); - - return $next($result); - } -} diff --git a/app/Statists/SystemStatist.php b/app/Statists/SystemStatist.php deleted file mode 100644 index c268aa3..0000000 --- a/app/Statists/SystemStatist.php +++ /dev/null @@ -1,22 +0,0 @@ -system_id ?? 0) . '.' . ($task->assignee_id ?? 0) . - '.' . $task->workflow_id . '.' . $task->status_id; - $node = Arr::get($result, $key, ['total' => 0, 'test' => 0, 'overdue' => 0]); - $node['total'] = $node['total'] + 1; - $node['test'] = $node['test'] + $task->ready_to_test; - $node['overdue'] = $node['overdue'] + ($task->on_time? 0: 1); - Arr::set($result, $key, $node); - - return $next($tasks); - } -} diff --git a/app/Statists/TagStatist.php b/app/Statists/TagStatist.php deleted file mode 100644 index 33bd15f..0000000 --- a/app/Statists/TagStatist.php +++ /dev/null @@ -1,54 +0,0 @@ -first()->project_id; - - $tags = $tasks->pluck('tag_id'); - $users = $tasks->pluck('assignee_id'); - $workflows = $tasks->pluck('workflow_id'); - $statuses = $tasks->pluck('status_id'); - - foreach ($tags as $tag) { - foreach ($users as $user) { - foreach ($workflows as $workflow) { - foreach ($statuses as $status) { - $filter = $tasks - ->where('sprint_id', '=', $tag) - ->where('assignee_id', '=', $user) - ->where('workflow_id', '=', $workflow) - ->where('status_id', '=', $status); - - if ($filter->isEmpty()) { - continue; - } - - $stat = [ - 'task_count' => $filter->count(), - 'total_worked_in_minute' => $filter->sum('spent_time'), - 'overdue_count' => $filter->where('on_time','=',false)->count(), - 'total_estimate_in_minute' => $filter->sum('estimated_time'), - 'test_flag_count' => $filter->where('ready_to_test', '=', true)->count(), - ]; - - Arr::set($result,"{$tag}.{$user}.{$workflow}.{$status}",$stat); - } - } - } - } - - - Cache::put($project, $result); - - return $next($tasks); - } -} diff --git a/app/Utilities/Exceptions/Handler.php b/app/Utilities/Exceptions/Handler.php index 79c1dec..8d01e2b 100644 --- a/app/Utilities/Exceptions/Handler.php +++ b/app/Utilities/Exceptions/Handler.php @@ -1,6 +1,6 @@ method = $method; $this->service = $service; $this->path = $path; $this->data = $data; $this->onQueue($queue); $this->onConnection('database'); } /** * Execute the job. * * @return void */ public function handle() { call($this->method, $this->service, $this->path, $this->data); } } \ No newline at end of file +method = $method; + $this->service = $service; + $this->path = $path; + $this->data = $data; + $this->onQueue($queue); + $this->onConnection('database'); + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + call($this->method, $this->service, $this->path, $this->data); + } +} diff --git a/app/Utilities/Logger/CreateCustomLogger.php b/app/Utilities/Logger/CreateCustomLogger.php index 53898b6..ab07317 100644 --- a/app/Utilities/Logger/CreateCustomLogger.php +++ b/app/Utilities/Logger/CreateCustomLogger.php @@ -1,6 +1,6 @@ has('business_id') ? $request->business_id : $request->route('business'); $businessInfo = env('CONTAINER_NAME') == 'hi-user-app' ? \App\Business::info($business_id) : get('user', env('USER_URL') . 'actions/businesses/' . $business_id . '/info', []); $request->merge(['_business_info' => $businessInfo]); return $next($request); } } \ No newline at end of file +has('business_id') ? $request->business_id : $request->route('business'); + $businessInfo = env('CONTAINER_NAME') == 'hi-user-app' ? + \App\Business::info($business_id) : + get('user', env('USER_URL') . 'actions/businesses/' . $business_id . '/info', []); + + + $request->merge(['_business_info' => $businessInfo]); + + return $next($request); + } +} diff --git a/app/Utilities/Models/Model.php b/app/Utilities/Models/Model.php index 6c66291..1dd9b0f 100644 --- a/app/Utilities/Models/Model.php +++ b/app/Utilities/Models/Model.php @@ -1,6 +1,6 @@ app['auth']->viaRequest('api', function (Request $request) { // with token if ($request->bearerToken()) { return $this->loginUserWithToken($request); } // first party if ($request->getHost() === $container_name = getenv('CONTAINER_NAME')) { return $this->loginServiceWithSetUser($container_name); } // without token return null; }); } public function loginUserWithToken(Request $request): User { $attributes = Http::retry(3, 100) ->withToken($request->bearerToken()) ->get(env('USER_URL') . 'auth') ->json(); $attributes = Arr::get($attributes, 'data',[]); // dd($attributes); return new User($attributes); } public function loginServiceWithSetUser(string $container_name): User { Auth::setUser($user = new User([ 'name' => $container_name, 'is_service' => true, ])); return $user; } } \ No newline at end of file +app['auth']->viaRequest('api', function (Request $request) { + // with token + if ($request->bearerToken()) { + return $this->loginUserWithToken($request); + } + + // first party + if ($request->getHost() === $container_name = getenv('CONTAINER_NAME')) { + return $this->loginServiceWithSetUser($container_name); + } + + // without token + return null; + }); + } + + public function loginUserWithToken(Request $request): User + { + $attributes = Http::retry(3, 100) + ->withToken($request->bearerToken()) + ->get(env('USER_URL') . 'auth') + ->json(); + + $attributes = Arr::get($attributes, 'data',[]); + +// dd($attributes); + return new User($attributes); + } + + public function loginServiceWithSetUser(string $container_name): User + { + Auth::setUser($user = new User([ + 'name' => $container_name, + 'is_service' => true, + ])); + + return $user; + } +} diff --git a/app/Utilities/Providers/HiLibraryServiceProvider.php b/app/Utilities/Providers/HiLibraryServiceProvider.php index 6c8ac8b..7ac7c8e 100644 --- a/app/Utilities/Providers/HiLibraryServiceProvider.php +++ b/app/Utilities/Providers/HiLibraryServiceProvider.php @@ -1,6 +1,6 @@ = 7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/random_compat/issues", - "source": "https://github.com/paragonie/random_compat" - }, - "time": "2020-10-15T08:29:30+00:00" - }, { "name": "php-amqplib/php-amqplib", - "version": "v2.12.3", + "version": "v2.12.1", "source": { "type": "git", "url": "https://github.com/php-amqplib/php-amqplib.git", - "reference": "f746eb44df6d8f838173729867dd1d20b0265faa" + "reference": "0eaaa9d5d45335f4342f69603288883388c2fe21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-amqplib/php-amqplib/zipball/f746eb44df6d8f838173729867dd1d20b0265faa", - "reference": "f746eb44df6d8f838173729867dd1d20b0265faa", + "url": "https://api.github.com/repos/php-amqplib/php-amqplib/zipball/0eaaa9d5d45335f4342f69603288883388c2fe21", + "reference": "0eaaa9d5d45335f4342f69603288883388c2fe21", "shasum": "" }, "require": { "ext-mbstring": "*", "ext-sockets": "*", - "php": ">=5.6.3,<8.0", - "phpseclib/phpseclib": "^2.0|^3.0" + "php": ">=5.6.3", + "phpseclib/phpseclib": "^2.0.0" }, "conflict": { "php": "7.4.0 - 7.4.1" @@ -3139,7 +3022,7 @@ "ext-curl": "*", "nategood/httpful": "^0.2.20", "phpunit/phpunit": "^5.7|^6.5|^7.0", - "squizlabs/php_codesniffer": "^3.5" + "squizlabs/php_codesniffer": "^2.5" }, "type": "library", "extra": { @@ -3186,9 +3069,9 @@ ], "support": { "issues": "https://github.com/php-amqplib/php-amqplib/issues", - "source": "https://github.com/php-amqplib/php-amqplib/tree/v2.12.3" + "source": "https://github.com/php-amqplib/php-amqplib/tree/v2.12.1" }, - "time": "2021-03-01T12:21:31+00:00" + "time": "2020-09-25T18:34:58+00:00" }, { "name": "phpoption/phpoption", @@ -3261,26 +3144,24 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.5", + "version": "2.0.30", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "7c751ea006577e4c2e83326d90c8b1e8c11b8ede" + "reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7c751ea006577e4c2e83326d90c8b1e8c11b8ede", - "reference": "7c751ea006577e4c2e83326d90c8b1e8c11b8ede", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/136b9ca7eebef78be14abf90d65c5e57b6bc5d36", + "reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36", "shasum": "" }, "require": { - "paragonie/constant_time_encoding": "^1|^2", - "paragonie/random_compat": "^1.4|^2.0|^9.99.99", - "php": ">=5.6.1" + "php": ">=5.3.3" }, "require-dev": { "phing/phing": "~2.7", - "phpunit/phpunit": "^5.7|^6.0|^9.4", + "phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4", "squizlabs/php_codesniffer": "~2.0" }, "suggest": { @@ -3295,7 +3176,7 @@ "phpseclib/bootstrap.php" ], "psr-4": { - "phpseclib3\\": "phpseclib/" + "phpseclib\\": "phpseclib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3352,7 +3233,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.5" + "source": "https://github.com/phpseclib/phpseclib/tree/2.0.30" }, "funding": [ { @@ -3368,7 +3249,7 @@ "type": "tidelift" } ], - "time": "2021-02-12T16:18:16+00:00" + "time": "2020-12-17T05:42:04+00:00" }, { "name": "psr/cache", @@ -4140,29 +4021,30 @@ }, { "name": "spatie/laravel-medialibrary", - "version": "8.10.1", + "version": "9.4.2", "source": { "type": "git", "url": "https://github.com/spatie/laravel-medialibrary.git", - "reference": "72b408972ba0b994eb52f39d38169621699e549b" + "reference": "fe8dcb2a56b3061cd29d072c1e983a1e035a1671" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/72b408972ba0b994eb52f39d38169621699e549b", - "reference": "72b408972ba0b994eb52f39d38169621699e549b", + "url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/fe8dcb2a56b3061cd29d072c1e983a1e035a1671", + "reference": "fe8dcb2a56b3061cd29d072c1e983a1e035a1671", "shasum": "" }, "require": { + "ext-exif": "*", "ext-fileinfo": "*", "ext-json": "*", - "illuminate/bus": "^6.18|^7.0|^8.0", - "illuminate/console": "^6.18|^7.0|^8.0", - "illuminate/database": "^6.18|^7.0|^8.0", - "illuminate/pipeline": "^6.18|^7.0|^8.0", - "illuminate/support": "^6.18|^7.0|^8.0", + "illuminate/bus": "^7.0|^8.0", + "illuminate/console": "^7.0|^8.0", + "illuminate/database": "^7.0|^8.0", + "illuminate/pipeline": "^7.0|^8.0", + "illuminate/support": "^7.0|^8.0", "league/flysystem": "^1.0.64", "maennchen/zipstream-php": "^1.0|^2.0", - "php": "^7.4", + "php": "^7.4|^8.0", "spatie/image": "^1.4.0", "spatie/temporary-directory": "^1.1", "symfony/console": "^4.4|^5.0" @@ -4178,8 +4060,7 @@ "guzzlehttp/guzzle": "^6.3|^7.0", "league/flysystem-aws-s3-v3": "^1.0.23", "mockery/mockery": "^1.3", - "orchestra/testbench": "^4.0|^5.0|^6.0", - "php-ffmpeg/php-ffmpeg": "^0.16.0", + "orchestra/testbench": "^5.0|^6.0", "phpunit/phpunit": "^9.1", "spatie/pdf-to-image": "^2.0", "spatie/phpunit-snapshot-assertions": "^4.0" @@ -4228,7 +4109,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-medialibrary/issues", - "source": "https://github.com/spatie/laravel-medialibrary/tree/8.10.1" + "source": "https://github.com/spatie/laravel-medialibrary/tree/9.4.2" }, "funding": [ { @@ -4240,7 +4121,7 @@ "type": "github" } ], - "time": "2020-10-05T21:54:57+00:00" + "time": "2021-01-15T07:55:54+00:00" }, { "name": "spatie/laravel-query-builder", @@ -4363,76 +4244,6 @@ }, "time": "2020-11-09T15:54:21+00:00" }, - { - "name": "spatie/laravel-query-builder", - "version": "3.3.4", - "source": { - "type": "git", - "url": "https://github.com/spatie/laravel-query-builder.git", - "reference": "2e131b0c8ae600b6e3aabb5a1501c721862a0b8f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-query-builder/zipball/2e131b0c8ae600b6e3aabb5a1501c721862a0b8f", - "reference": "2e131b0c8ae600b6e3aabb5a1501c721862a0b8f", - "shasum": "" - }, - "require": { - "illuminate/database": "^6.0|^7.0|^8.0", - "illuminate/http": "^6.0|^7.0|^8.0", - "illuminate/support": "^6.0|^7.0|^8.0", - "php": "^7.3|^8.0" - }, - "require-dev": { - "ext-json": "*", - "laravel/legacy-factories": "^1.0.4", - "mockery/mockery": "^1.4", - "orchestra/testbench": "^4.9|^5.8|^6.3", - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Spatie\\QueryBuilder\\QueryBuilderServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Spatie\\QueryBuilder\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alex Vanderbist", - "email": "alex@spatie.be", - "homepage": "https://spatie.be", - "role": "Developer" - } - ], - "description": "Easily build Eloquent queries from API requests", - "homepage": "https://github.com/spatie/laravel-query-builder", - "keywords": [ - "laravel-query-builder", - "spatie" - ], - "support": { - "issues": "https://github.com/spatie/laravel-query-builder/issues", - "source": "https://github.com/spatie/laravel-query-builder" - }, - "funding": [ - { - "url": "https://spatie.be/open-source/support-us", - "type": "custom" - } - ], - "time": "2020-11-26T14:51:30+00:00" - }, { "name": "swiftmailer/swiftmailer", "version": "v6.2.5", @@ -9515,9 +9326,9 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^7.3|^8.0", "ext-gd": "*", - "ext-json": "*" + "ext-json": "*", + "php": "^7.3|^8.0" }, "platform-dev": [], "plugin-api-version": "2.0.0" diff --git a/config.default/app.php b/config.default/app.php deleted file mode 100644 index 2a2f0eb..0000000 --- a/config.default/app.php +++ /dev/null @@ -1,232 +0,0 @@ - env('APP_NAME', 'Laravel'), - - /* - |-------------------------------------------------------------------------- - | Application Environment - |-------------------------------------------------------------------------- - | - | This value determines the "environment" your application is currently - | running in. This may determine how you prefer to configure various - | services the application utilizes. Set this in your ".env" file. - | - */ - - 'env' => env('APP_ENV', 'production'), - - /* - |-------------------------------------------------------------------------- - | Application Debug Mode - |-------------------------------------------------------------------------- - | - | When your application is in debug mode, detailed error messages with - | stack traces will be shown on every error that occurs within your - | application. If disabled, a simple generic error page is shown. - | - */ - - 'debug' => (bool) env('APP_DEBUG', false), - - /* - |-------------------------------------------------------------------------- - | Application URL - |-------------------------------------------------------------------------- - | - | This URL is used by the console to properly generate URLs when using - | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. - | - */ - - 'url' => env('APP_URL', 'http://localhost'), - - 'asset_url' => env('ASSET_URL', null), - - /* - |-------------------------------------------------------------------------- - | Application Timezone - |-------------------------------------------------------------------------- - | - | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. - | - */ - - 'timezone' => 'UTC', - - /* - |-------------------------------------------------------------------------- - | Application Locale Configuration - |-------------------------------------------------------------------------- - | - | The application locale determines the default locale that will be used - | by the translation service provider. You are free to set this value - | to any of the locales which will be supported by the application. - | - */ - - 'locale' => 'en', - - /* - |-------------------------------------------------------------------------- - | Application Fallback Locale - |-------------------------------------------------------------------------- - | - | The fallback locale determines the locale to use when the current one - | is not available. You may change the value to correspond to any of - | the language folders that are provided through your application. - | - */ - - 'fallback_locale' => 'en', - - /* - |-------------------------------------------------------------------------- - | Faker Locale - |-------------------------------------------------------------------------- - | - | This locale will be used by the Faker PHP library when generating fake - | data for your database seeds. For example, this will be used to get - | localized telephone numbers, street address information and more. - | - */ - - 'faker_locale' => 'en_US', - - /* - |-------------------------------------------------------------------------- - | Encryption Key - |-------------------------------------------------------------------------- - | - | This key is used by the Illuminate encrypter service and should be set - | to a random, 32 character string, otherwise these encrypted strings - | will not be safe. Please do this before deploying an application! - | - */ - - 'key' => env('APP_KEY'), - - 'cipher' => 'AES-256-CBC', - - /* - |-------------------------------------------------------------------------- - | Autoloaded Service Providers - |-------------------------------------------------------------------------- - | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ - - 'providers' => [ - - /* - * Laravel Framework Service Providers... - */ - Illuminate\Auth\AuthServiceProvider::class, - Illuminate\Broadcasting\BroadcastServiceProvider::class, - Illuminate\Bus\BusServiceProvider::class, - Illuminate\Cache\CacheServiceProvider::class, - Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, - Illuminate\Cookie\CookieServiceProvider::class, - Illuminate\Database\DatabaseServiceProvider::class, - Illuminate\Encryption\EncryptionServiceProvider::class, - Illuminate\Filesystem\FilesystemServiceProvider::class, - Illuminate\Foundation\Providers\FoundationServiceProvider::class, - Illuminate\Hashing\HashServiceProvider::class, - Illuminate\Mail\MailServiceProvider::class, - Illuminate\Notifications\NotificationServiceProvider::class, - Illuminate\Pagination\PaginationServiceProvider::class, - Illuminate\Pipeline\PipelineServiceProvider::class, - Illuminate\Queue\QueueServiceProvider::class, - Illuminate\Redis\RedisServiceProvider::class, - Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, - Illuminate\Session\SessionServiceProvider::class, - Illuminate\Translation\TranslationServiceProvider::class, - Illuminate\Validation\ValidationServiceProvider::class, - Illuminate\View\ViewServiceProvider::class, - - /* - * Package Service Providers... - */ - - /* - * Application Service Providers... - */ - App\Providers\AppServiceProvider::class, - App\Providers\AuthServiceProvider::class, - // App\Providers\BroadcastServiceProvider::class, - App\Providers\EventServiceProvider::class, - App\Providers\RouteServiceProvider::class, - - ], - - /* - |-------------------------------------------------------------------------- - | Class Aliases - |-------------------------------------------------------------------------- - | - | This array of class aliases will be registered when this application - | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. - | - */ - - 'aliases' => [ - - 'App' => Illuminate\Support\Facades\App::class, - 'Arr' => Illuminate\Support\Arr::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, - 'Bus' => Illuminate\Support\Facades\Bus::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, - 'Http' => Illuminate\Support\Facades\Http::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, - 'Notification' => Illuminate\Support\Facades\Notification::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, - // 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, - 'Str' => Illuminate\Support\Str::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'View' => Illuminate\Support\Facades\View::class, - - ], - -]; diff --git a/config.default/filesystems.php b/config.default/filesystems.php deleted file mode 100644 index 10c9d9b..0000000 --- a/config.default/filesystems.php +++ /dev/null @@ -1,72 +0,0 @@ - env('FILESYSTEM_DRIVER', 'local'), - - /* - |-------------------------------------------------------------------------- - | Filesystem Disks - |-------------------------------------------------------------------------- - | - | Here you may configure as many filesystem "disks" as you wish, and you - | may even configure multiple disks of the same driver. Defaults have - | been setup for each driver as an example of the required options. - | - | Supported Drivers: "local", "ftp", "sftp", "s3" - | - */ - - 'disks' => [ - - 'local' => [ - 'driver' => 'local', - 'root' => storage_path('app'), - ], - - 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', - 'visibility' => 'public', - ], - - 's3' => [ - 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), - ], - - ], - - /* - |-------------------------------------------------------------------------- - | Symbolic Links - |-------------------------------------------------------------------------- - | - | Here you may configure the symbolic links that will be created when the - | `storage:link` Artisan command is executed. The array keys should be - | the locations of the links and the values should be their targets. - | - */ - - 'links' => [ - public_path('storage') => storage_path('app/public'), - ], - -]; diff --git a/config.default/logging.php b/config.default/logging.php deleted file mode 100644 index 6aa77fe..0000000 --- a/config.default/logging.php +++ /dev/null @@ -1,104 +0,0 @@ - env('LOG_CHANNEL', 'stack'), - - /* - |-------------------------------------------------------------------------- - | Log Channels - |-------------------------------------------------------------------------- - | - | Here you may configure the log channels for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Drivers: "single", "daily", "slack", "syslog", - | "errorlog", "monolog", - | "custom", "stack" - | - */ - - 'channels' => [ - 'stack' => [ - 'driver' => 'stack', - 'channels' => ['single'], - 'ignore_exceptions' => false, - ], - - 'single' => [ - 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), - ], - - 'daily' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), - 'days' => 14, - ], - - 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => env('LOG_LEVEL', 'critical'), - ], - - 'papertrail' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => SyslogUdpHandler::class, - 'handler_with' => [ - 'host' => env('PAPERTRAIL_URL'), - 'port' => env('PAPERTRAIL_PORT'), - ], - ], - - 'stderr' => [ - 'driver' => 'monolog', - 'handler' => StreamHandler::class, - 'formatter' => env('LOG_STDERR_FORMATTER'), - 'with' => [ - 'stream' => 'php://stderr', - ], - ], - - 'syslog' => [ - 'driver' => 'syslog', - 'level' => env('LOG_LEVEL', 'debug'), - ], - - 'errorlog' => [ - 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'debug'), - ], - - 'null' => [ - 'driver' => 'monolog', - 'handler' => NullHandler::class, - ], - - 'emergency' => [ - 'path' => storage_path('logs/laravel.log'), - ], - ], - -]; diff --git a/config.default/services.php b/config.default/services.php deleted file mode 100644 index 2a1d616..0000000 --- a/config.default/services.php +++ /dev/null @@ -1,33 +0,0 @@ - [ - 'domain' => env('MAILGUN_DOMAIN'), - 'secret' => env('MAILGUN_SECRET'), - 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), - ], - - 'postmark' => [ - 'token' => env('POSTMARK_TOKEN'), - ], - - 'ses' => [ - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - ], - -]; diff --git a/config/amqp.php b/config/amqp.php deleted file mode 100644 index 1b1f582..0000000 --- a/config/amqp.php +++ /dev/null @@ -1,73 +0,0 @@ - env('AMQP_CONNECTION', 'rabbitmq'), - - /*Available connections*/ - 'connections' => [ - - 'rabbitmq' => [ - 'connection' => [ - 'host' => env('AMQP_HOST', 'liwo_redis_1'), - 'port' => env('AMQP_PORT', 5672), - 'username' => env('AMQP_USERNAME', 'root'), - 'password' => env('AMQP_PASSWORD', 'root'), - 'vhost' => env('AMQP_VHOST', '/'), - 'connect_options' => [], - 'ssl_options' => [], - 'ssl_protocol' => env('AMQP_SSL_PROTOCOL', 'ssl'), - ], - - 'channel_id' => null, - - 'message' => [ - 'content_type' => 'text/plain', - 'delivery_mode' => env('AMQP_MESSAGE_DELIVERY_MODE', AMQPMessage::DELIVERY_MODE_PERSISTENT), - 'content_encoding' => 'UTF-8', - ], - - 'exchange' => [ - 'name' => env('AMQP_EXCHANGE_NAME', 'activity_exchange'), - 'declare' => env('AMQP_EXCHANGE_DECLARE', false), - 'type' => env('AMQP_EXCHANGE_TYPE', 'headers'), - 'passive' => env('AMQP_EXCHANGE_PASSIVE', false), - 'durable' => env('AMQP_EXCHANGE_DURABLE', true), - 'auto_delete' => env('AMQP_EXCHANGE_AUTO_DEL', false), - 'internal' => env('AMQP_EXCHANGE_INTERNAL', false), - 'nowait' => env('AMQP_EXCHANGE_NOWAIT', false), - 'properties' => [], - ], - - 'queue' => [ - 'declare' => env('AMQP_QUEUE_DECLARE', false), - 'passive' => env('AMQP_QUEUE_PASSIVE', false), - 'durable' => env('AMQP_QUEUE_DURABLE', true), - 'exclusive' => env('AMQP_QUEUE_EXCLUSIVE', false), - 'auto_delete' => env('AMQP_QUEUE_AUTO_DEL', false), - 'nowait' => env('AMQP_QUEUE_NOWAIT', false), - 'd_properties' => [], // queue_declare properties/arguments - 'b_properties' => [], // queue_bind properties/arguments - ], - - 'consumer' => [ - 'tag' => env('AMQP_CONSUMER_TAG', ''), - 'no_local' => env('AMQP_CONSUMER_NO_LOCAL', false), - 'no_ack' => env('AMQP_CONSUMER_NO_ACK', false), - 'exclusive' => env('AMQP_CONSUMER_EXCLUSIVE', false), - 'nowait' => env('AMQP_CONSUMER_NOWAIT', false), - 'ticket' => null, - 'properties' => [], - ], - - 'qos' => [ - 'enabled' => env('AMQP_QOS_ENABLED', false), - 'qos_prefetch_size' => env('AMQP_QOS_PREF_SIZE', 0), - 'qos_prefetch_count' => env('AMQP_QOS_PREF_COUNT', 1), - 'qos_a_global' => env('AMQP_QOS_GLOBAL', false), - ], - ], - ], -]; diff --git a/config/app.php b/config/app.php index 1675900..cc438b2 100644 --- a/config/app.php +++ b/config/app.php @@ -1,13 +1,18 @@ env('APP_NAME', 'Laravel'), 'env' => env('APP_ENV', 'production'), 'debug' => (bool) env('APP_DEBUG', false), - 'timezone' => 'Asia/Tehran', + 'url' => env('APP_URL', 'http://localhost'), + + 'asset_url' => env('ASSET_URL', null), + + 'timezone' => 'UTC', 'locale' => 'fa', @@ -15,5 +20,89 @@ return [ 'faker_locale' => 'fa_IR', - 'cache_ttl' => 60 + 'key' => env('APP_KEY'), + + 'cipher' => 'AES-256-CBC', + + 'providers' => [ + + /* + * Laravel Framework Service Providers... + */ + Illuminate\Auth\AuthServiceProvider::class, + Illuminate\Broadcasting\BroadcastServiceProvider::class, + Illuminate\Bus\BusServiceProvider::class, + Illuminate\Cache\CacheServiceProvider::class, + Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, + Illuminate\Cookie\CookieServiceProvider::class, + Illuminate\Database\DatabaseServiceProvider::class, + Illuminate\Encryption\EncryptionServiceProvider::class, + Illuminate\Filesystem\FilesystemServiceProvider::class, + Illuminate\Foundation\Providers\FoundationServiceProvider::class, + Illuminate\Hashing\HashServiceProvider::class, + Illuminate\Mail\MailServiceProvider::class, + Illuminate\Notifications\NotificationServiceProvider::class, + Illuminate\Pagination\PaginationServiceProvider::class, + Illuminate\Pipeline\PipelineServiceProvider::class, + Illuminate\Queue\QueueServiceProvider::class, + Illuminate\Redis\RedisServiceProvider::class, + Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, + Illuminate\Session\SessionServiceProvider::class, + Illuminate\Translation\TranslationServiceProvider::class, + Illuminate\Validation\ValidationServiceProvider::class, + Illuminate\View\ViewServiceProvider::class, + + /* + * Package Service Providers... + */ + + /* + * Application Service Providers... + */ + App\Providers\AppServiceProvider::class, + App\Providers\AuthServiceProvider::class, + App\Providers\BroadcastServiceProvider::class, + App\Providers\EventServiceProvider::class, + App\Providers\RouteServiceProvider::class, + ], + + 'aliases' => [ + + 'App' => Illuminate\Support\Facades\App::class, + 'Arr' => Illuminate\Support\Arr::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Http' => Illuminate\Support\Facades\Http::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, + 'Notification' => Illuminate\Support\Facades\Notification::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redis' => Illuminate\Support\Facades\Redis::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'Str' => Illuminate\Support\Str::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'View' => Illuminate\Support\Facades\View::class, + ], ]; diff --git a/config.default/auth.php b/config/auth.php similarity index 100% rename from config.default/auth.php rename to config/auth.php diff --git a/config.default/broadcasting.php b/config/broadcasting.php similarity index 100% rename from config.default/broadcasting.php rename to config/broadcasting.php diff --git a/config.default/cache.php b/config/cache.php similarity index 100% rename from config.default/cache.php rename to config/cache.php diff --git a/config/cors.php b/config/cors.php index c3ded3c..8a39e6d 100644 --- a/config/cors.php +++ b/config/cors.php @@ -1,59 +1,34 @@ ['/*'], + 'paths' => ['api/*', 'sanctum/csrf-cookie'], - /* - * Matches the request method. `['*']` allows all methods. - */ 'allowed_methods' => ['*'], - /* - * Matches the request origin. `['*']` allows all origins. Wildcards can be used, eg `*.mydomain.com` - */ 'allowed_origins' => ['*'], - /* - * Patterns that can be used with `preg_match` to match the origin. - */ - 'allowedOriginsPatterns' => ['Content-Type', 'X-Requested-With'], + 'allowed_origins_patterns' => [], - /* - * Sets the Access-Control-Allow-Headers response header. `['*']` allows all headers. - */ 'allowed_headers' => ['*'], - /* - * Sets the Access-Control-Expose-Headers response header with these headers. - */ 'exposed_headers' => [], - /* - * Sets the Access-Control-Max-Age response header when > 0. - */ 'max_age' => 0, - /* - * Sets the Access-Control-Allow-Credentials header. - */ 'supports_credentials' => false, + ]; diff --git a/config/cors.php.laravel b/config/cors.php.laravel new file mode 100644 index 0000000..c3ded3c --- /dev/null +++ b/config/cors.php.laravel @@ -0,0 +1,59 @@ + ['/*'], + + /* + * Matches the request method. `['*']` allows all methods. + */ + 'allowed_methods' => ['*'], + + /* + * Matches the request origin. `['*']` allows all origins. Wildcards can be used, eg `*.mydomain.com` + */ + 'allowed_origins' => ['*'], + + /* + * Patterns that can be used with `preg_match` to match the origin. + */ + 'allowedOriginsPatterns' => ['Content-Type', 'X-Requested-With'], + + /* + * Sets the Access-Control-Allow-Headers response header. `['*']` allows all headers. + */ + 'allowed_headers' => ['*'], + + /* + * Sets the Access-Control-Expose-Headers response header with these headers. + */ + 'exposed_headers' => [], + + /* + * Sets the Access-Control-Max-Age response header when > 0. + */ + 'max_age' => 0, + + /* + * Sets the Access-Control-Allow-Credentials header. + */ + 'supports_credentials' => false, +]; diff --git a/config.default/cors.php b/config/cors.php.lumen similarity index 100% rename from config.default/cors.php rename to config/cors.php.lumen diff --git a/config.default/database.php b/config/database.php similarity index 100% rename from config.default/database.php rename to config/database.php diff --git a/config.default/hashing.php b/config/hashing.php similarity index 100% rename from config.default/hashing.php rename to config/hashing.php diff --git a/config/logging.php b/config/logging.php index 9013913..c6f3fe5 100644 --- a/config/logging.php +++ b/config/logging.php @@ -16,7 +16,7 @@ return [ 'handler' => AmqpHandler::class, 'with' => [ 'exchange' => new AMQPChannel( - new AMQPStreamConnection("liwo_redis_1", 5672, 'root', 'root') + new AMQPStreamConnection("liwo_rabbitmq_1", 5672, 'root', 'root') ), 'exchangeName' => 'log_exchange' ], diff --git a/config.default/mail.php b/config/mail.php similarity index 100% rename from config.default/mail.php rename to config/mail.php diff --git a/config.default/queue.php b/config/queue.php similarity index 100% rename from config.default/queue.php rename to config/queue.php diff --git a/config.default/session.php b/config/session.php similarity index 100% rename from config.default/session.php rename to config/session.php diff --git a/config.default/view.php b/config/view.php similarity index 100% rename from config.default/view.php rename to config/view.php diff --git a/definitions.json b/definitions.json new file mode 100644 index 0000000..10ab903 --- /dev/null +++ b/definitions.json @@ -0,0 +1,152 @@ +{ + "queues": [ + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "name": "activity_queue", + "type": "classic", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "name": "notif_queue", + "type": "classic", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "name": "socket_queue", + "type": "classic", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "name": "log_queue", + "type": "classic", + "vhost": "/" + } + ], + "exchanges": [ + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "name": "activity_exchange", + "type": "headers", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "name": "notif_exchange", + "type": "headers", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "name": "socket_exchange", + "type": "headers", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "name": "log_exchange", + "type": "fanout", + "vhost": "/" + } + ], + "bindings": [ + { + "arguments": { + "x-match": "any", + "name" : "activity" + }, + "destination": "activity_queue", + "destination_type": "queue", + "routing_key": "", + "source": "activity_exchange", + "vhost": "/" + }, + { + "arguments": { + "x-match": "any", + "name" : "notif" + }, + "destination": "notif_queue", + "destination_type": "queue", + "routing_key": "", + "source": "notif_exchange", + "vhost": "/" + }, + { + "arguments": { + "x-match": "any", + "name" : "socket" + }, + "destination": "socket_queue", + "destination_type": "queue", + "routing_key": "", + "source": "socket_exchange", + "vhost": "/" + }, + { + "arguments": {}, + "destination": "log_queue", + "destination_type": "queue", + "routing_key": "", + "source": "log_exchange", + "vhost": "/" + } + ], + + "global_parameters": [ + { + "name": "cluster_name", + "value": "rabbit@258a143f3102" + } + ], + "parameters": [], + "permissions": [ + { + "configure": ".*", + "read": ".*", + "user": "root", + "vhost": "/", + "write": ".*" + } + ], + "policies": [], + "rabbit_version": "3.8.5", + "rabbitmq_version": "3.8.5", + "topic_permissions": [], + "users": [ + { + "hashing_algorithm": "rabbit_password_hashing_sha256", + "name": "root", + "password_hash": "Y0AhwjtK6iQM0t0Hp9t9nBey8zzMBa3LuszL3zlZ1mGtWsif", + "tags": "administrator" + } + ], + "vhosts": [ + { + "limits": [], + "metadata": { + "description": "Default virtual host", + "tags": [] + }, + "name": "/" + } + ] +} diff --git a/docker-compose.yml b/docker-compose.yml index 46e149f..3093ea1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,22 @@ # For more information: https://laravel.com/docs/sail version: '3' services: + rabbitmq: + image: "rabbitmq:3-management" + ports: + - 5672:5672 + - 15672:15672 + environment: + RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG" + RABBITMQ_DEFAULT_USER: "root" + RABBITMQ_DEFAULT_PASS: "root" + RABBITMQ_DEFAULT_VHOST: "/" + networks: + - sail + volumes: + - ./definitions.json:/etc/rabbitmq/definitions.json + depends_on: + - laravel minio: image: minio/minio command: server /data @@ -11,6 +27,8 @@ services: MINIO_SECRET_KEY: minioroot networks: - sail + depends_on: + - laravel commander: image: rediscommander/redis-commander:latest environment: @@ -25,6 +43,8 @@ services: - redis networks: - sail + depends_on: + - redis redis: image: redis:latest ports: @@ -34,7 +54,7 @@ services: - redis-data:/data networks: - sail - laravel.test: + laravel: build: context: ./vendor/laravel/sail/runtimes/8.0 dockerfile: Dockerfile @@ -68,7 +88,7 @@ services: - sail healthcheck: test: ["CMD", "mysqladmin", "ping"] - myadmin: + pma: image: 'phpmyadmin:latest' ports: - 8080:80 diff --git a/routes/api.php b/routes/api.php index c92d4b3..ced6847 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,6 +1,6 @@ group(['prefix' => 'actions'], function () use ($router) { $router->group(['prefix' => 'businesses'], function () use ($router) { @@ -165,36 +165,36 @@ $router->group(['prefix' => 'users'], function () use ($router) { }); $router->group([], function () use ($router) { $router->post('/log', 'ActivityController@store'); - $router->group(['prefix' => 'businesses/{business}', 'middleware' => ['auth', 'bindBusiness']], function (Router $router) { + $router->group(['prefix' => 'businesses/{business}', 'middleware' => ['auth', 'bindBusiness']], function ($router) { $router->get('/tasks', 'TaskController@index'); $router->get('/works', 'WorkController@index'); $router->get('statistics', 'StatisticController@index'); $router->get('projects/{project}/statistics', 'StatisticController@index'); $router->get('/tasks/{task}', 'TaskController@show'); - $router->group(['prefix' => 'projects/{project}/tasks'], function (Router $router) { + $router->group(['prefix' => 'projects/{project}/tasks'], function ($router) { $router->post('/', 'TaskController@store'); - $router->group(['prefix' => '{task}'], function (Router $router) { + $router->group(['prefix' => '{task}'], function ($router) { $router->get('/', 'TaskController@show'); $router->put('/', 'TaskController@update'); $router->delete('/', 'TaskController@destroy'); $router->post('/watchers', 'TaskController@toggleWatcher'); - $router->group(['prefix' => 'works'], function (Router $router) { + $router->group(['prefix' => 'works'], function ($router) { // $router->get('/', 'WorkController@index'); $router->post('/', 'WorkController@store'); - $router->group(['prefix' => '{work}'], function (Router $router) { + $router->group(['prefix' => '{work}'], function ($router) { $router->get('/', 'WorkController@show'); $router->put('/', 'WorkController@update'); $router->delete('/', 'WorkController@destroy'); }); }); - $router->group(['prefix' => 'comments'], function (Router $router) { + $router->group(['prefix' => 'comments'], function ($router) { $router->get('/', 'CommentController@index'); $router->post('/', 'CommentController@store'); - $router->group(['prefix' => '{comment}'], function (Router $router) { + $router->group(['prefix' => '{comment}'], function ($router) { $router->get('/', 'CommentController@show'); $router->put('/', 'CommentController@update'); $router->delete('/', 'CommentController@destroy');