diff --git a/src/Illuminate/View/Compilers/BladeCompiler.php b/src/Illuminate/View/Compilers/BladeCompiler.php index e188990f1aab..8f3642ec629d 100644 --- a/src/Illuminate/View/Compilers/BladeCompiler.php +++ b/src/Illuminate/View/Compilers/BladeCompiler.php @@ -425,7 +425,7 @@ public function check($name, ...$parameters) } /** - * Register a component alias. + * Register a component alias directive. * * @param string $path * @param string $alias @@ -436,11 +436,9 @@ public function component($path, $alias = null) $alias = $alias ?: array_last(explode('.', $path)); $this->directive($alias, function ($expression) use ($path) { - if ($expression) { - return "startComponent('{$path}', {$expression}); ?>"; - } else { - return "startComponent('{$path}'); ?>"; - } + return $expression + ? "startComponent('{$path}', {$expression}); ?>" + : "startComponent('{$path}'); ?>"; }); $this->directive('end'.$alias, function ($expression) use ($path) {