Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update includes facade to use trait instead of repeated logic #1551

Merged
merged 1 commit into from
Feb 12, 2024
Merged
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
11 changes: 3 additions & 8 deletions packages/framework/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);
}
}
}
Loading