Advertisement
ghiwar

post.blade.php

May 28th, 2019
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. @php
  2.     $images = collect($images)->shuffle()->take(6)->toArray();
  3. @endphp
  4. @php
  5.     shuffle($sentences);
  6. @endphp
  7.  
  8. @if(!empty($sentences))
  9.     <p>{{ @array_pop($sentences) }} {{ @array_pop($sentences) }}</p>
  10. @endif
  11.  
  12.     @foreach(collect($images)->shuffle()->chunk(3) as $chunked)
  13.         @if($loop->iteration == 2)
  14.             <div class="text-left">
  15.                 <h3>{{ @array_pop($sentences) }}</h3>
  16.                 <img src="{{ str_replace(array('https://' , 'http://') , 'https://i0.wp.com/', collect($images)->random()['url']) }}" width="34%" align="left" style="margin-right: 8px;margin-bottom: 8px;">
  17.                 @foreach(collect($sentences)->chunk(3) as $chunked_sentences)
  18.             <p>
  19.                 @if($loop->first) <strong>{{ ucfirst($keyword) }}</strong>. @endif @foreach($chunked_sentences as $chunked_sentence){{ $chunked_sentence }} @endforeach
  20.             </p>
  21.         @endforeach
  22.             </div>
  23.         @endif
  24.         <div class="row">
  25.             @foreach($chunked as $image)
  26.                 <div class="column">
  27.                     <img class="img-fluid" src="{{ str_replace(array('https://' , 'http://') , 'https://i0.wp.com/', $image['url'] )}}" style="width:100%">
  28.                     <p>{{ $image['title'] }}</p>
  29.                 </div>
  30.             @endforeach
  31.         </div>
  32.     @endforeach
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement