Skip to content

Commit

Permalink
Merge pull request #595 from hydephp/update-includes-facade-to-use-tr…
Browse files Browse the repository at this point in the history
…ait-instead-of-repeated-logic

Update includes facade to use trait instead of repeated logic
  • Loading branch information
caendesilva authored Feb 13, 2024
2 parents 2465936 + 2d42830 commit 529d09b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/Support/Includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -20,6 +20,8 @@
*/
class Includes
{
use InteractsWithDirectories;

/**
* @var string The directory where includes are stored.
*/
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 529d09b

Please sign in to comment.