Skip to content

Commit

Permalink
When request is missing middleware, fallback to nocache view
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Jan 26, 2024
1 parent faf29f1 commit ba4cdd9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/StaticCaching/NoCache/BladeDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Statamic\StaticCaching\NoCache;

use Statamic\StaticCaching\Middleware\Cache;

class BladeDirective
{
/**
Expand All @@ -22,9 +24,12 @@ public function handle($expression, array $params, ?array $data = null)
}

$view = $expression;

$context = array_merge($data, $params);

if (! Cache::$requestCanBeCached) {
return view($view, $context)->render();
}

return $this->nocache->pushView($view, $context)->placeholder();
}
}

0 comments on commit ba4cdd9

Please sign in to comment.