Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Inertia;

use Carbon\CarbonInterval;
use Closure;
use GuzzleHttp\Promise\PromiseInterface;
use Illuminate\Contracts\Support\Arrayable;
Expand Down Expand Up @@ -70,13 +69,6 @@ class Response implements Responsable
*/
protected $viewData = [];

/**
* The cache duration settings.
*
* @var array<int, mixed>
*/
protected $cacheFor = [];

/**
* The URL resolver callback.
*/
Expand Down Expand Up @@ -154,19 +146,6 @@ public function rootView(string $rootView): self
return $this;
}

/**
* Set the cache duration for the response.
*
* @param string|array<int, mixed> $cacheFor
* @return $this
*/
public function cache(string|array $cacheFor): self
{
$this->cacheFor = is_array($cacheFor) ? $cacheFor : [$cacheFor];

return $this;
}

/**
* Create an HTTP response that represents the object.
*
Expand All @@ -188,7 +167,6 @@ public function toResponse($request)
],
$this->resolveMergeProps($request),
$this->resolveDeferredProps($request),
$this->resolveCacheDirections($request),
$this->resolveScrollProps($request),
$this->resolveOnceProps($request),
);
Expand Down Expand Up @@ -456,28 +434,6 @@ public function resolvePropertyInstances(array $props, Request $request, ?string
return $props;
}

/**
* Resolve the cache directions for the response.
*
* @return array<string, mixed>
*/
public function resolveCacheDirections(Request $request): array
{
if (count($this->cacheFor) === 0) {
return [];
}

return [
'cache' => collect($this->cacheFor)->map(function ($value) {
if ($value instanceof CarbonInterval) {
return $value->totalSeconds;
}

return intval($value);
}),
];
}

/**
* Parse props from request headers.
*
Expand Down