laravel - Blade @include directive -
blade's @include
directive, allows include blade view within existing view. variables available parent view made available included view. how can hide parent values included view? want use variables sent or else, use default variables.
for example, consider following view. can access variable named $title
<a class="btn btn-danger" href="{{$url or url::previous()}}"><i class="fa fa-arrow-left"></i> {{$title or 'save'}} </a>
not prettiest solution, think handle putting of vars in array:
<a class="btn btn-danger" href="{{$mydata['url'] or url::previous()}}"><i class="fa fa-arrow-left"></i> {{$mydata['title'] or 'save'}} </a>
and including view: @include('view', ['mydata' => null])
note, untested.
Comments
Post a Comment