CompilesComponents.php 1017B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Illuminate\View\Compilers\Concerns;
  3. trait CompilesComponents
  4. {
  5. /**
  6. * Compile the component statements into valid PHP.
  7. *
  8. * @param string $expression
  9. * @return string
  10. */
  11. protected function compileComponent($expression)
  12. {
  13. return "<?php \$__env->startComponent{$expression}; ?>";
  14. }
  15. /**
  16. * Compile the end-component statements into valid PHP.
  17. *
  18. * @return string
  19. */
  20. protected function compileEndComponent()
  21. {
  22. return '<?php echo $__env->renderComponent(); ?>';
  23. }
  24. /**
  25. * Compile the slot statements into valid PHP.
  26. *
  27. * @param string $expression
  28. * @return string
  29. */
  30. protected function compileSlot($expression)
  31. {
  32. return "<?php \$__env->slot{$expression}; ?>";
  33. }
  34. /**
  35. * Compile the end-slot statements into valid PHP.
  36. *
  37. * @return string
  38. */
  39. protected function compileEndSlot()
  40. {
  41. return '<?php $__env->endSlot(); ?>';
  42. }
  43. }