From c9b48c62ca85194631166d91773d8ae5a1fae34c Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 12 Feb 2024 15:18:31 +0000 Subject: [PATCH] Merge pull request #1551 from hydephp/improved-includes Update includes facade to use trait instead of repeated logic https://github.com/hydephp/develop/commit/e058e3afe0189d1d8a16684e011658ffc242bda5 --- src/Support/Includes.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Support/Includes.php b/src/Support/Includes.php index 23a0b5ed..08ff8f00 100644 --- a/src/Support/Includes.php +++ b/src/Support/Includes.php @@ -7,11 +7,11 @@ use Hyde\Hyde; use Hyde\Markdown\Models\Markdown; use Illuminate\Support\Facades\Blade; +use Hyde\Framework\Concerns\InteractsWithDirectories; use function basename; use function file_exists; use function file_get_contents; -use function mkdir; /** * The Includes facade provides a simple way to access partials in the includes directory. @@ -20,6 +20,8 @@ */ class Includes { + use InteractsWithDirectories; + /** * @var string The directory where includes are stored. */ @@ -93,11 +95,4 @@ public static function blade(string $filename, ?string $default = null): ?string return Blade::render(file_get_contents($path)); } - - protected static function needsDirectory(string $directory): void - { - if (! file_exists($directory)) { - mkdir($directory, recursive: true); - } - } }