diff --git a/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php b/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php index 47be0db653da..e6a20dcf97a2 100644 --- a/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php +++ b/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php @@ -119,4 +119,25 @@ protected function compileEndAuth() { return ''; } + + /** + * Compile the if-guest statements into valid PHP. + * + * @param string|null $guard + * @return string + */ + protected function compileGuest($guard = null) + { + return "guard{$guard}->guest()): ?>"; + } + + /** + * Compile the end-guest statements into valid PHP. + * + * @return string + */ + protected function compileEndGuest() + { + return ''; + } } diff --git a/tests/View/Blade/BladeIfGuestStatementsTest.php b/tests/View/Blade/BladeIfGuestStatementsTest.php new file mode 100644 index 000000000000..b52d01479d31 --- /dev/null +++ b/tests/View/Blade/BladeIfGuestStatementsTest.php @@ -0,0 +1,32 @@ +getFiles(), __DIR__); + $string = '@guest("api") +breeze +@endguest'; + $expected = 'guard("api")->guest()): ?> +breeze +'; + $this->assertEquals($expected, $compiler->compileString($string)); + } + + protected function getFiles() + { + return m::mock('Illuminate\Filesystem\Filesystem'); + } +}