Skip to content

Commit

Permalink
#289 - Laravel 10 update (#294)
Browse files Browse the repository at this point in the history
* - Bump laravel/framework from 9.49.0 to 9.52.4

Bumps [laravel/framework](https://github.com/laravel/framework) from 9.49.0 to 9.52.4.
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/10.x/CHANGELOG.md)
- [Commits](laravel/framework@v9.49.0...v9.52.4)

---
updated-dependencies:
- dependency-name: laravel/framework
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* - batch update March 2023

* - batch update March 2023

* - fix

* #293 - testing during weekends

* #293 - testing during weekends

* #293 - PHP 8.2 bump

* #293 - code review tweaks

* Update composer.json

Co-authored-by: Marcin Tracz <[email protected]>

* #293 - cleaning-up

* #293 - code review changes

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: EwelinaLasowy <[email protected]>
Co-authored-by: Marcin Tracz <[email protected]>
  • Loading branch information
4 people authored Mar 20, 2023
1 parent 32302c9 commit be278d8
Show file tree
Hide file tree
Showing 34 changed files with 1,360 additions and 1,352 deletions.
37 changes: 18 additions & 19 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,9 @@ DB_USERNAME=toby
DB_PASSWORD=password
DB_ROOT_PASSWORD=example

EXTERNAL_WEBSERVER_PORT=8181
EXTERNAL_NODE_PORT=5857

DOCKER_DEV_DB_EXTERNAL_PORT=5432
DOCKER_DEV_DB_DATABASE=${DB_DATABASE}
DOCKER_DEV_DB_USERNAME=${DB_USERNAME}
DOCKER_DEV_DB_PASSWORD=${DB_PASSWORD}
DOCKER_DEV_DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}

DOCKER_TEST_DB_EXTERNAL_PORT=5433
DOCKER_TEST_DB_DATABASE=${DB_DATABASE}
DOCKER_TEST_DB_USERNAME=${DB_USERNAME}
DOCKER_TEST_DB_PASSWORD=${DB_PASSWORD}
DOCKER_TEST_DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}

REDIS_PORT=6379
REDIS_HOST=toby-redis

XDG_CONFIG_HOME=/tmp

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=redis
Expand All @@ -54,8 +37,6 @@ MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME="${APP_NAME}"

DOCKER_INSTALL_XDEBUG=false

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CALENDAR_ENABLED=true
Expand All @@ -68,3 +49,21 @@ SLACK_ENABLED=true
SLACK_CLIENT_TOKEN=
SLACK_SIGNING_SECRET=
SLACK_DEFAULT_CHANNEL="#general"

EXTERNAL_WEBSERVER_PORT=8181
EXTERNAL_NODE_PORT=5857

DOCKER_INSTALL_XDEBUG=false
XDG_CONFIG_HOME=/tmp

DOCKER_DEV_DB_EXTERNAL_PORT=5432
DOCKER_DEV_DB_DATABASE=${DB_DATABASE}
DOCKER_DEV_DB_USERNAME=${DB_USERNAME}
DOCKER_DEV_DB_PASSWORD=${DB_PASSWORD}
DOCKER_DEV_DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}

DOCKER_TEST_DB_EXTERNAL_PORT=5433
DOCKER_TEST_DB_DATABASE=${DB_DATABASE}
DOCKER_TEST_DB_USERNAME=${DB_USERNAME}
DOCKER_TEST_DB_PASSWORD=${DB_PASSWORD}
DOCKER_TEST_DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
2 changes: 1 addition & 1 deletion .github/workflows/test-and-lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, intl
coverage: none

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ google-credentials.json
.idea/
.composer
.deployment
/.phpunit.cache
2 changes: 0 additions & 2 deletions app/Architecture/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class AuthServiceProvider extends ServiceProvider

public function boot(): void
{
$this->registerPolicies();

Gate::before(function (User $user) {
if ($user->role === Role::Administrator) {
return true;
Expand Down
5 changes: 4 additions & 1 deletion app/Architecture/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public function boot(): void

protected function configureRateLimiting(): void
{
RateLimiter::for("api", fn(Request $request): Limit => Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()));
RateLimiter::for(
"api",
fn(Request $request): Limit => Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()),
);
}
}
23 changes: 18 additions & 5 deletions app/Infrastructure/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,27 @@

namespace Toby\Infrastructure\Console;

use Illuminate\Cache\Console\PruneStaleTagsCommand;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Toby\Infrastructure\Console\Commands\Database\BackupPostgresDatabase;
use Toby\Infrastructure\Console\Commands\SendDailySummaryToSlack;
use Toby\Infrastructure\Console\Commands\SendVacationRequestSummariesToApprovers;
use Toby\Infrastructure\Jobs\CheckYearPeriod;

class Kernel extends ConsoleKernel
{
protected function commands(): void
{
$this->load(__DIR__ . "/Commands");
}

/**
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function schedule(Schedule $schedule): void
{
$schedule->command(SendDailySummaryToSlack::class)
Expand All @@ -27,14 +39,15 @@ protected function schedule(Schedule $schedule): void
$schedule->job(CheckYearPeriod::class)
->yearlyOn(1, 1, "01:00");

$this->scheduleDatabaseBackup($schedule);
}
$schedule->command(PruneStaleTagsCommand::class)->hourly();

protected function commands(): void
{
$this->load(__DIR__ . "/Commands");
$this->scheduleDatabaseBackup($schedule);
}

/**
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function scheduleDatabaseBackup(Schedule $schedule): void
{
$scheduledTask = $schedule->command(BackupPostgresDatabase::class)
Expand Down
2 changes: 0 additions & 2 deletions app/Infrastructure/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
namespace Toby\Infrastructure\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}
6 changes: 3 additions & 3 deletions app/Infrastructure/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Toby\Infrastructure\Http;

use Fruitcake\Cors\HandleCors;
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
use Illuminate\Auth\Middleware\Authorize;
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
Expand All @@ -16,6 +15,7 @@
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance;
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Http\Middleware\HandleCors;
use Illuminate\Http\Middleware\SetCacheHeaders;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Routing\Middleware\ThrottleRequests;
Expand Down Expand Up @@ -53,11 +53,11 @@ class Kernel extends HttpKernel
],
"api" => [
EnsureFrontendRequestsAreStateful::class,
"throttle:api",
ThrottleRequests::class . "throttle:api",
SubstituteBindings::class,
],
];
protected $routeMiddleware = [
protected $middlewareAliases = [
"auth" => Authenticate::class,
"auth.basic" => AuthenticateWithBasicAuth::class,
"cache.headers" => SetCacheHeaders::class,
Expand Down
5 changes: 3 additions & 2 deletions app/Infrastructure/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
namespace Toby\Infrastructure\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;

class Authenticate extends Middleware
{
protected function redirectTo($request): string
protected function redirectTo(Request $request): ?string
{
return route("login");
return $request->expectsJson() ? null : route("login");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class RedirectIfAuthenticated
{
public function handle(Request $request, Closure $next, ...$guards): Response
public function handle(Request $request, Closure $next, string ...$guards): Response
{
$guards = empty($guards) ? [null] : $guards;

Expand Down
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,28 @@
"azuyalabs/yasumi": "^2.4",
"barryvdh/laravel-dompdf": "^2.0",
"doctrine/dbal": "^3.3",
"fruitcake/laravel-cors": "^3.0",
"guzzlehttp/guzzle": "^7.0.1",
"inertiajs/inertia-laravel": "^0.6.2",
"laravel/framework": "^9.7",
"laravel/sanctum": "^3.0",
"laravel/framework": "^10.4.0",
"laravel/sanctum": "^3.2",
"laravel/socialite": "^5.2",
"laravel/telescope": "^4.6",
"laravel/tinker": "^2.5",
"maatwebsite/excel": "^3.1",
"phpoffice/phpword": "^1.0.0",
"rackbeat/laravel-ui-avatars": "^1.0",
"rackbeat/laravel-ui-avatars": "^1.2",
"spatie/laravel-google-calendar": "^3.5",
"spatie/laravel-model-states": "^2.1",
"spatie/laravel-slack-slash-command": "^1.11"
},
"require-dev": {
"blumilksoftware/codestyle": "^1.3",
"blumilksoftware/codestyle": "^2.0",
"fakerphp/faker": "^1.19",
"laravel/dusk": "^7.1",
"mockery/mockery": "^1.5",
"nunomaduro/collision": "^6.2",
"phpunit/phpunit": "^9.5",
"spatie/laravel-ignition": "^1.2"
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -74,6 +73,6 @@
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true
}
Loading

0 comments on commit be278d8

Please sign in to comment.