논리

2017-11-02 12 views
0

나는 언젠가 내가 단지 H1이 블레이드 템플릿논리

@component('components.section', ['classes' => 'lightgrey']) 
     @slot('heading') 
     The best thing ever.... 
     @endslot 
     @slot('subheading') 

     @endslot 
     @slot('copy') 
     Lots of interesting words go here 
     @endslot 
@endcomponent 

에서

<section class="section {{ $classes }}"> 
      <div class="inner"> 
      <h1>{{ $heading }}</h1> 
      <h2>{{ $subheading }}</h2> 
      <p>{{ $copy }}</p> 
      </div> 

      {{ $slot }} 
</section> 

내가 렌더링 laravel 구성 요소를 가지고있다. 하위 제목이 없으면 어떻게 마크 업을 제거 할 수 있습니까? Laravel 워드 프로세서에서

답변

0

: https://laravel.com/docs/5.5/blade

@isset@empty 지침은 각 PHP 함수에 대한 편리한 단축키로 사용할 수 있습니다

@isset($records) 
    // $records is defined and is not null... 
@endisset 

@empty($records) 
    // $records is "empty"... 
@endempty 

나는 이것이 아마 일 것이라고 생각하고있다 :

@isset($subheading) 
    @slot('subheading') 

    @endslot 
@endisset