Skip to content

Commit

Permalink
Merge pull request #1551 from hydephp/improved-includes
Browse files Browse the repository at this point in the history
Update includes facade to use trait instead of repeated logic
  • Loading branch information
caendesilva authored Feb 12, 2024
2 parents 222eba1 + 7c517e6 commit e058e3a
Showing 1 changed file with 3 additions and 8 deletions.
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);
}
}
}

0 comments on commit e058e3a

Please sign in to comment.