fix: tymon/jwt-auth incompatibility with Laravel 5.8

This commit is contained in:
Phan An 2020-02-24 22:57:24 +01:00
parent 9e5843fe66
commit 8d2b7b3842
4 changed files with 372 additions and 262 deletions

View file

@ -0,0 +1,39 @@
From 653ea67ccf5987b16815d0d4cd4ae4f6147b8649 Mon Sep 17 00:00:00 2001
From: An Phan <me@phanan.net>
Date: Mon, 24 Feb 2020 22:28:43 +0100
Subject: [PATCH] Replace fire() with dispatch()
---
src/Middleware/BaseMiddleware.php | 2 +-
src/Middleware/GetUserFromToken.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Middleware/BaseMiddleware.php b/src/Middleware/BaseMiddleware.php
index 9715f0c..cba7f8f 100644
--- a/src/Middleware/BaseMiddleware.php
+++ b/src/Middleware/BaseMiddleware.php
@@ -57,7 +57,7 @@ abstract class BaseMiddleware
*/
protected function respond($event, $error, $status, $payload = [])
{
- $response = $this->events->fire($event, $payload, true);
+ $response = $this->events->dispatch($event, $payload, true);
return $response ?: $this->response->json(['error' => $error], $status);
}
diff --git a/src/Middleware/GetUserFromToken.php b/src/Middleware/GetUserFromToken.php
index af3b21c..7542158 100644
--- a/src/Middleware/GetUserFromToken.php
+++ b/src/Middleware/GetUserFromToken.php
@@ -41,7 +41,7 @@ class GetUserFromToken extends BaseMiddleware
return $this->respond('tymon.jwt.user_not_found', 'user_not_found', 404);
}
- $this->events->fire('tymon.jwt.valid', $user);
+ $this->events->dispatch('tymon.jwt.valid', $user);
return $next($request);
}
--
2.24.0

View file

@ -9,7 +9,7 @@
"laravel/framework": "5.8.*",
"james-heinrich/getid3": "^1.9",
"guzzlehttp/guzzle": "^6.1",
"tymon/jwt-auth": "^0.5.6",
"tymon/jwt-auth": "^0.5.12",
"aws/aws-sdk-php-laravel": "^3.1",
"pusher/pusher-php-server": "^4.0",
"predis/predis": "~1.0",
@ -21,7 +21,8 @@
"ext-SimpleXML": "*",
"fideloper/proxy": "^4.0",
"daverandom/resume": "^0.0.3",
"laravel/helpers": "^1.0"
"laravel/helpers": "^1.0",
"cweagans/composer-patches": "^1.6"
},
"require-dev": {
"filp/whoops": "~2.0",
@ -87,5 +88,12 @@
"optimize-autoloader": true
},
"minimum-stability": "stable",
"prefer-stable": false
"prefer-stable": false,
"extra": {
"patches": {
"tymon/jwt-auth": {
"Replace fire() with dispatch()": ".patches/tymon/jwt-auth/replace-fire-with-dispatch.patch"
}
}
}
}

579
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -123,7 +123,7 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
'Tymon\JWTAuth\Providers\JWTAuthServiceProvider', // hard-coding to make it compatible with patching procedure
Aws\Laravel\AwsServiceProvider::class,
Jackiedo\DotenvEditor\DotenvEditorServiceProvider::class,