PHP code example of konradkalemba / blade-components-scoped-slots
1. Go to this page and download the library: Download konradkalemba/blade-components-scoped-slots library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
konradkalemba / blade-components-scoped-slots example snippets
@component('components.list', ['objects' => $objects])
@scopedslot('item', ($object))
// It is also possible to pass outside variable to the scoped slot
// by using the third parameter: @scopedslot('item', ($object), ($variable))
<li>
{{ $object->name }}
@if($object->isEditable)
<a href="{{ route('objects.edit', $object->id) }}">{{ __('Edit') }}</a>
@endif
</li>
@endscopedslot
@endcomponent
<ul>
@foreach($objects as $object)
{{ $item($object) }}
@endforeach
</ul>