Skip to content

Commit

Permalink
Update ControllerDecorator.php for Laravel 9 and 10 compatibility (#266)
Browse files Browse the repository at this point in the history
References #265 265
  • Loading branch information
n3storm authored Jan 8, 2024
1 parent 5250614 commit 54b73e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Decorators/ControllerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public function __invoke(string $method)

$response = $this->run($method);

if ($this->hasMethod('jsonResponse') && $request->expectsJson()) {
if ($this->hasMethod('jsonResponse') && ($request->expectsJson() || $request->isJson())) {
$response = $this->callMethod('jsonResponse', [$response, $request]);
} elseif ($this->hasMethod('htmlResponse') && ! $request->expectsJson()) {
} elseif ($this->hasMethod('htmlResponse') && ! ($request->expectsJson() || $request->isJson())) {
$response = $this->callMethod('htmlResponse', [$response, $request]);
}

Expand Down

0 comments on commit 54b73e2

Please sign in to comment.