From 500768816dbc5b376d50b0a2772a6346da0ebfc6 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 11:28:49 +0100 Subject: [PATCH 01/17] test --- config/database.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/database.php b/config/database.php index 4593682..25319c0 100644 --- a/config/database.php +++ b/config/database.php @@ -31,6 +31,7 @@ return [ ], "default" => [ "scheme" => "tls", + "read_timeout" => -1, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), @@ -39,6 +40,7 @@ return [ ], "cache" => [ "scheme" => "tls", + "read_timeout" => -1, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), From 3145baf34e21080472a9f73a8fecf35c8d52dc32 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 11:31:36 +0100 Subject: [PATCH 02/17] test --- config/database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/database.php b/config/database.php index 25319c0..cdc1c5c 100644 --- a/config/database.php +++ b/config/database.php @@ -31,7 +31,7 @@ return [ ], "default" => [ "scheme" => "tls", - "read_timeout" => -1, + "read_timeout" => 0, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), @@ -40,7 +40,7 @@ return [ ], "cache" => [ "scheme" => "tls", - "read_timeout" => -1, + "read_timeout" => 0, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), From 1300d312e0f8ac79aa86699cc149d020025f556f Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 11:42:55 +0100 Subject: [PATCH 03/17] test --- config/database.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/database.php b/config/database.php index cdc1c5c..0ab09ab 100644 --- a/config/database.php +++ b/config/database.php @@ -30,8 +30,6 @@ return [ "prefix" => env("REDIS_PREFIX", Str::slug(env("APP_NAME", "laravel"), "_") . "_database_"), ], "default" => [ - "scheme" => "tls", - "read_timeout" => 0, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), @@ -39,8 +37,6 @@ return [ "database" => env("REDIS_DB", "0"), ], "cache" => [ - "scheme" => "tls", - "read_timeout" => 0, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), From 39f8a748bdfd79b7943780028f94a663e251c662 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:04:04 +0100 Subject: [PATCH 04/17] test --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 48aab52..bd63c31 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: vendor/bin/heroku-php-apache2 public/ +web: vendor/bin/heroku-php-nginx public/ From 519bc06167f946abf4df480aaab29dfc6222a499 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:09:41 +0100 Subject: [PATCH 05/17] test --- Procfile | 2 +- nginx.conf | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 nginx.conf diff --git a/Procfile b/Procfile index bd63c31..61c6039 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: vendor/bin/heroku-php-nginx public/ +web: vendor/bin/heroku-php-nginx -C nginx.conf public/ diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..b03455d --- /dev/null +++ b/nginx.conf @@ -0,0 +1,10 @@ +if ($http_x_forwarded_proto != 'https') { + rewrite ^ https://$host$request_uri? permanent; +} + +location / { + try_files $uri @rewriteapp; +} +location @rewriteapp { + rewrite ^(.*)$ /index.php$1 last; +} \ No newline at end of file From 48ae3e2e54b40ef014f2015effc52282445b89dc Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:20:45 +0100 Subject: [PATCH 06/17] test --- Procfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Procfile b/Procfile index 61c6039..57f0a4b 100644 --- a/Procfile +++ b/Procfile @@ -1 +1,2 @@ web: vendor/bin/heroku-php-nginx -C nginx.conf public/ +release: php artisan migrate && php artisan db:seed --class=DemoSeeder && php artisan cache:clear && php artisan config:cache \ No newline at end of file From 16cc1da7b8ac6900cffae2deb87b2608b143a5cb Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:23:43 +0100 Subject: [PATCH 07/17] test --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 57f0a4b..326b9e4 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ web: vendor/bin/heroku-php-nginx -C nginx.conf public/ -release: php artisan migrate && php artisan db:seed --class=DemoSeeder && php artisan cache:clear && php artisan config:cache \ No newline at end of file +release: php artisan migrate --force && php artisan db:seed --class=DemoSeeder --force && php artisan cache:clear && php artisan config:cache \ No newline at end of file From c9739b6d692cf28e3c469e0fb7135061c8deaf19 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:28:46 +0100 Subject: [PATCH 08/17] test --- composer.json | 2 +- composer.lock | 136 +++++++++++++++++++++++++------------------------- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/composer.json b/composer.json index 7f21608..a10744d 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "ext-redis": "*", "azuyalabs/yasumi": "^2.4", "barryvdh/laravel-dompdf": "^1.0", + "fakerphp/faker": "^1.19", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "inertiajs/inertia-laravel": "^0.5.1", @@ -27,7 +28,6 @@ "require-dev": { "blumilksoftware/codestyle": "^0.10.0", "spatie/laravel-ignition": "^1.0", - "fakerphp/faker": "^1.9.1", "laravel/dusk": "^6.21", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", diff --git a/composer.lock b/composer.lock index 6b8a37c..ebb8dd1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c5b402774b90f0e4bb912ca08a44a143", + "content-hash": "0ee65ae15107942cb5ad2ee8067d514c", "packages": [ { "name": "asm89/stack-cors", @@ -813,6 +813,73 @@ }, "time": "2020-10-16T08:27:54+00:00" }, + { + "name": "fakerphp/faker", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v1.19-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" + }, + "time": "2022-02-02T17:38:57+00:00" + }, { "name": "firebase/php-jwt", "version": "v5.5.1", @@ -8004,73 +8071,6 @@ ], "time": "2022-03-03T08:28:38+00:00" }, - { - "name": "fakerphp/faker", - "version": "v1.19.0", - "source": { - "type": "git", - "url": "https://github.com/FakerPHP/Faker.git", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0", - "psr/container": "^1.0 || ^2.0", - "symfony/deprecation-contracts": "^2.2 || ^3.0" - }, - "conflict": { - "fzaninotto/faker": "*" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "doctrine/persistence": "^1.3 || ^2.0", - "ext-intl": "*", - "symfony/phpunit-bridge": "^4.4 || ^5.2" - }, - "suggest": { - "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", - "ext-curl": "Required by Faker\\Provider\\Image to download images.", - "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", - "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", - "ext-mbstring": "Required for multibyte Unicode string functionality." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "v1.19-dev" - } - }, - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "François Zaninotto" - } - ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "support": { - "issues": "https://github.com/FakerPHP/Faker/issues", - "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" - }, - "time": "2022-02-02T17:38:57+00:00" - }, { "name": "filp/whoops", "version": "2.14.5", From b8e52ba09d7399b01944c0b50b3454203e373f53 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:48:24 +0100 Subject: [PATCH 09/17] test --- app/Infrastructure/Http/Middleware/TrustProxies.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/Infrastructure/Http/Middleware/TrustProxies.php b/app/Infrastructure/Http/Middleware/TrustProxies.php index b3d08f4..7e34570 100644 --- a/app/Infrastructure/Http/Middleware/TrustProxies.php +++ b/app/Infrastructure/Http/Middleware/TrustProxies.php @@ -9,12 +9,6 @@ use Symfony\Component\HttpFoundation\Request; class TrustProxies extends Middleware { - protected $proxies; - - protected $headers = - Request::HEADER_X_FORWARDED_FOR | - Request::HEADER_X_FORWARDED_HOST | - Request::HEADER_X_FORWARDED_PORT | - Request::HEADER_X_FORWARDED_PROTO | - Request::HEADER_X_FORWARDED_AWS_ELB; + protected $proxies = '*'; + protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB; } From 21fc7ef3a5e6e8b303a7be988948fe36b8305601 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:49:05 +0100 Subject: [PATCH 10/17] test --- Procfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 326b9e4..d308221 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,3 @@ web: vendor/bin/heroku-php-nginx -C nginx.conf public/ -release: php artisan migrate --force && php artisan db:seed --class=DemoSeeder --force && php artisan cache:clear && php artisan config:cache \ No newline at end of file +release: php artisan migrate --force && php artisan db:seed --class=DemoSeeder --force && php artisan cache:clear && php artisan config:cache +worker: php artisan queue:work From 5311208a951c9d8a1826b7653bc52ffe5386d7cb Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 13:10:31 +0100 Subject: [PATCH 11/17] test --- resources/js/Pages/VacationRequest/Create.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/Pages/VacationRequest/Create.vue b/resources/js/Pages/VacationRequest/Create.vue index e0139d5..2678078 100644 --- a/resources/js/Pages/VacationRequest/Create.vue +++ b/resources/js/Pages/VacationRequest/Create.vue @@ -372,7 +372,7 @@ export default { setup(props) { const form = useForm({ user: props.can.createOnBehalfOfEmployee - ? props.users.data.find(user => user.id === props.auth.user.id) + ? props.users.data.find(user => user.id === props.auth.user.id) ?? props.users.data[0] : props.auth.user, from: null, to: null, From f2cd72d99e0c82f409c7ffaf755f02dab467b8c0 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 13:14:06 +0100 Subject: [PATCH 12/17] test --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index d308221..da552c0 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ web: vendor/bin/heroku-php-nginx -C nginx.conf public/ -release: php artisan migrate --force && php artisan db:seed --class=DemoSeeder --force && php artisan cache:clear && php artisan config:cache +release: php artisan migrate --force && php artisan cache:clear && php artisan config:cache worker: php artisan queue:work From 07de8e827514c1261edafd653850a806bc09eaa0 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 14:13:32 +0100 Subject: [PATCH 13/17] test --- .profile | 1 + 1 file changed, 1 insertion(+) create mode 100644 .profile diff --git a/.profile b/.profile new file mode 100644 index 0000000..1a5622b --- /dev/null +++ b/.profile @@ -0,0 +1 @@ +echo ${GOOGLE_CREDENTIALS} > /storage/app/google-calendar/service-account-credentials.json \ No newline at end of file From 7aa9a52f8c94b07f6c651e1409e73e6b6b95cded Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 14:32:46 +0100 Subject: [PATCH 14/17] test --- .gitignore | 1 + .profile | 1 - config/google-calendar.php | 7 +------ readme.md | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 .profile diff --git a/.gitignore b/.gitignore index 63cf7ed..569e675 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,6 @@ Homestead.json Homestead.yaml npm-debug.log yarn-error.log +google-credentials.json .idea/ .composer diff --git a/.profile b/.profile deleted file mode 100644 index 1a5622b..0000000 --- a/.profile +++ /dev/null @@ -1 +0,0 @@ -echo ${GOOGLE_CREDENTIALS} > /storage/app/google-calendar/service-account-credentials.json \ No newline at end of file diff --git a/config/google-calendar.php b/config/google-calendar.php index e50a33b..da66b8c 100644 --- a/config/google-calendar.php +++ b/config/google-calendar.php @@ -6,14 +6,9 @@ return [ "default_auth_profile" => env("GOOGLE_CALENDAR_AUTH_PROFILE", "service_account"), "auth_profiles" => [ "service_account" => [ - "credentials_json" => storage_path("app/google-calendar/service-account-credentials.json"), - ], - "oauth" => [ - "credentials_json" => storage_path("app/google-calendar/oauth-credentials.json"), - "token_json" => storage_path("app/google-calendar/oauth-token.json"), + "credentials_json" => base_path("google-credentials.json"), ], ], - "calendar_id" => env("GOOGLE_CALENDAR_ID"), "user_to_impersonate" => env("GOOGLE_CALENDAR_IMPERSONATE"), ]; diff --git a/readme.md b/readme.md index d25b8f7..f981e88 100644 --- a/readme.md +++ b/readme.md @@ -53,7 +53,7 @@ Directory structure little differs from a standard Laravel tree. We decided to r dcr node npm run dev -- place google credentials here: `/storage/app/google-calendar/service-account-credentials.json` ([how to obtain the credentials](https://github.com/spatie/laravel-google-calendar#how-to-obtain-the-credentials-to-communicate-with-google-calendar)) +- place google credentials here: `/google-credentials.json` ([how to obtain the credentials](https://github.com/spatie/laravel-google-calendar#how-to-obtain-the-credentials-to-communicate-with-google-calendar)) ### Available containers (local) From 7737b9e9c2da78e4d3ddbdd680c5dadb1547ef93 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 14:54:39 +0100 Subject: [PATCH 15/17] test --- app/Eloquent/Observers/UserObserver.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Eloquent/Observers/UserObserver.php b/app/Eloquent/Observers/UserObserver.php index 33a76e5..27ed217 100644 --- a/app/Eloquent/Observers/UserObserver.php +++ b/app/Eloquent/Observers/UserObserver.php @@ -6,6 +6,7 @@ namespace Toby\Eloquent\Observers; use Toby\Eloquent\Helpers\YearPeriodRetriever; use Toby\Eloquent\Models\User; +use Toby\Eloquent\Models\YearPeriod; class UserObserver { @@ -15,8 +16,12 @@ class UserObserver public function created(User $user): void { - $user->vacationLimits()->create([ - "year_period_id" => $this->yearPeriodRetriever->current()->id, - ]); + $yearPeriods = YearPeriod::all(); + + foreach ($yearPeriods as $yearPeriod) { + $user->vacationLimits()->create([ + "year_period_id" => $yearPeriod->id, + ]); + } } } From 4f17a7021c17721e577197223ce9939f52c24662 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 14:55:44 +0100 Subject: [PATCH 16/17] test --- app/Eloquent/Observers/UserObserver.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/Eloquent/Observers/UserObserver.php b/app/Eloquent/Observers/UserObserver.php index 27ed217..6921550 100644 --- a/app/Eloquent/Observers/UserObserver.php +++ b/app/Eloquent/Observers/UserObserver.php @@ -4,16 +4,11 @@ declare(strict_types=1); namespace Toby\Eloquent\Observers; -use Toby\Eloquent\Helpers\YearPeriodRetriever; use Toby\Eloquent\Models\User; use Toby\Eloquent\Models\YearPeriod; class UserObserver { - public function __construct( - protected YearPeriodRetriever $yearPeriodRetriever, - ) {} - public function created(User $user): void { $yearPeriods = YearPeriod::all(); From 969ca88ffd1615519b230f91452c0c72e2336490 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 15:11:19 +0100 Subject: [PATCH 17/17] test --- resources/js/Composables/statusInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/Composables/statusInfo.js b/resources/js/Composables/statusInfo.js index 91e7ceb..a9c94bd 100644 --- a/resources/js/Composables/statusInfo.js +++ b/resources/js/Composables/statusInfo.js @@ -125,7 +125,7 @@ const statuses = [ export function useStatusInfo() { const getStatues = () => statuses - const findStatus = value => statuses.find(month => month.value === value) + const findStatus = value => statuses.find(status => status.value === value) return { getStatues,