Skip to content

Commit 2ce484c

Browse files
committed
feat: add getenv + fix @method
1 parent 338de62 commit 2ce484c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Blade.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected function setupDefaultDirectives()
102102
});
103103

104104
$this->directive('method', function ($expression) {
105-
return "<?php echo '<input type=\"hidden\" name=\"_method\" value=\"' . $expression . '\" />'; ?>";
105+
return "<?php echo '<input type=\"hidden\" name=\"_METHOD\" value=\"' . $expression . '\" />'; ?>";
106106
});
107107

108108
$this->directive('json', function ($expression) {
@@ -145,6 +145,14 @@ protected function setupDefaultDirectives()
145145
return "<?php if (strtolower(_env('APP_ENV')) === strtolower($expression)) : ?>";
146146
});
147147

148+
$this->compiler()->directive('endenv', function ($expression) {
149+
return "<?php endif; ?>";
150+
});
151+
152+
$this->directive('getenv', function ($expression) {
153+
return "<?php echo _env($expression); ?>";
154+
});
155+
148156
$this->directive('session', function ($expression) {
149157
return implode('', [
150158
"<?php if (session()->has($expression)) : ?>",

0 commit comments

Comments
 (0)