Skip to content

Commit e90a1f0

Browse files
committed
fix: check if auth is installed on @auth
1 parent ea2563a commit e90a1f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ protected function setupDefaultDirectives()
292292
});
293293

294294
$this->compiler()->directive('auth', function ($expression) {
295-
return "<?php if (!!auth($expression)->user()) : ?>";
295+
return "<?php if (function_exists('auth') && !!auth($expression)->user()) : ?>";
296296
});
297297

298298
$this->compiler()->directive('guest', function ($expression) {
299-
return "<?php if (!auth($expression)->user()) : ?>";
299+
return "<?php if (!function_exists('auth') || (function_exists('auth') && !auth($expression)->user())) : ?>";
300300
});
301301

302302
$this->directive('is', function ($expression) {

0 commit comments

Comments
 (0)