PHP code example of jacksleight / blade-snip
1. Go to this page and download the library: Download jacksleight/blade-snip 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/ */
jacksleight / blade-snip example snippets
blade
<div class="products">
@snip('product', ['image' => null])
<div class="product">
@if ($image)
<img src="{{ $image }}">
@endif
<h1>Lorem Ipsum Dolor</h1>
<p>£{{ number_format($price ?? rand(10, 100)) }}</p>
<button>Add to Basket</button>
</div>
@endsnip
@stick('product')
@stick('product', ['image' => 'cheese.jpg'])
@stick('product', ['image' => 'potato.jpg', 'price' => 120])
{{-- or --}}
@spread('product', 3)
</div>