diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8777788 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +## V2.1.0 + ++ Update outdated json error response + +## V2.0.0 + ++ Upgrade to Laravel 9 and update related dependencies \ No newline at end of file diff --git a/composer.json b/composer.json index f9e437b..dc01bb6 100644 --- a/composer.json +++ b/composer.json @@ -17,11 +17,11 @@ "illuminate/support": "^9.0", "illuminate/session": "^9.0", "illuminate/pagination": "^9.0", - "mblsolutions/inspireddeck-php": "^1.5|^2.0" + "mblsolutions/inspireddeck-php": "^2.0" }, "require-dev": { "orchestra/testbench": "^7.0", - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": { diff --git a/src/InspiredDeckServiceProvider.php b/src/InspiredDeckServiceProvider.php index 24bf063..fc5f2d4 100644 --- a/src/InspiredDeckServiceProvider.php +++ b/src/InspiredDeckServiceProvider.php @@ -3,7 +3,6 @@ namespace MBLSolutions\InspiredDeckLaravel; use Illuminate\Contracts\Http\Kernel; -use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; use Illuminate\Support\ServiceProvider; use MBLSolutions\InspiredDeck\Exceptions\NotFoundException; @@ -12,6 +11,7 @@ use MBLSolutions\InspiredDeck\InspiredDeck; use MBLSolutions\InspiredDeckLaravel\Middleware\LoadInspiredDeckConfig; use Symfony\Component\HttpKernel\Exception\HttpException; +use Illuminate\Support\Facades\Response; class InspiredDeckServiceProvider extends ServiceProvider { @@ -64,13 +64,13 @@ public function registerMiddleware($middleware) * @param $request * @param $exception * @param callable|null $function - * @return JsonResponse|RedirectResponse + * @return \Illuminate\Http\JsonResponse|RedirectResponse */ public static function exceptionHandling($request, $exception, callable $function = null) { if (route_contains('async') || route_contains('api')) { if ($exception instanceof ValidationException) { - return JsonResponse::create([ + return Response::json([ 'message' => $exception->getMessage(), 'errors' => $exception->getValidationErrors() ], $exception->getCode()); @@ -98,4 +98,4 @@ public static function exceptionHandling($request, $exception, callable $functio return $function(); } -} \ No newline at end of file +}