From 250a3ed348023299bfd4d0a68ea2ab55ff9e902b Mon Sep 17 00:00:00 2001 From: Benjamin Michotte Date: Wed, 11 Oct 2017 14:23:21 +0200 Subject: [PATCH] Blade : add else in the custom if directive (#21611) Signed-off-by: Benjamin Michotte --- Compilers/BladeCompiler.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Compilers/BladeCompiler.php b/Compilers/BladeCompiler.php index 3638291f3..24a521161 100644 --- a/Compilers/BladeCompiler.php +++ b/Compilers/BladeCompiler.php @@ -387,6 +387,12 @@ public function if($name, callable $callback) : ""; }); + $this->directive('else'.$name, function ($expression) use ($name) { + return $expression + ? "" + : ""; + }); + $this->directive('end'.$name, function () { return ''; });