From 2ba7fd438f768394757cd6d6246c6ccc78c2bce6 Mon Sep 17 00:00:00 2001 From: erikn69 Date: Fri, 8 Jul 2022 11:48:04 -0500 Subject: [PATCH] Added required directive --- .../View/Compilers/Concerns/CompilesConditionals.php | 11 +++++++++++ tests/View/Blade/BladeCheckedStatementsTest.php | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php b/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php index 8f6c4ce8662a..2b1c0e8e41d4 100644 --- a/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php +++ b/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php @@ -338,6 +338,17 @@ protected function compileDisabled($condition) return ""; } + /** + * Compile a required block into valid PHP. + * + * @param string $condition + * @return string + */ + protected function compileRequired($condition) + { + return ""; + } + /** * Compile a readonly block into valid PHP. * diff --git a/tests/View/Blade/BladeCheckedStatementsTest.php b/tests/View/Blade/BladeCheckedStatementsTest.php index f689fbea0048..dfac6b457664 100644 --- a/tests/View/Blade/BladeCheckedStatementsTest.php +++ b/tests/View/Blade/BladeCheckedStatementsTest.php @@ -27,4 +27,12 @@ public function testDisabledStatementsAreCompiled() $this->assertEquals($expected, $this->compiler->compileString($string)); } + + public function testRequiredStatementsAreCompiled() + { + $string = ''; + $expected = "/>"; + + $this->assertEquals($expected, $this->compiler->compileString($string)); + } }