function makeProduct($page = []) { $collections = (array) \App\Product::collections(); $num = mt_rand(0, count($collections) - 1); $i = 0; $collection = ''; foreach ($collections as $k => $v) { if ($i == $num) { $collection = $k; } $i++; } $page['slug'] = isset($page['slug']) ? $page['slug'] : str_slug($page['title']); $page['images'] = isset($page['images']) ? $page['images'] : imgs(); $page['tech'] = isset($page['tech']) ? $page['tech'] : ''; $page['collection'] = $collection; $page['karlar'] = mt_rand(0, 1); $page['konur'] = mt_rand(0, 1); $array = \App\Product::product_types(); $key = array_rand($array); $value = $array[$key]; //print_r($bla[(mt_rand(0, count(\App\Product::product_types()) - 1))]); //$page['product_type'] = key(\App\Product::product_types()[(mt_rand(0, count(\App\Product::product_types()) - 1))]); //echo $key; $page['product_type'] = $key; return factory(\App\Product::class)->create($page); }
public function vorulina($vorulina) { $collections = \App\Product::collections(); if (array_key_exists($vorulina, $collections)) { $data['items'] = \App\Product::where('collection', $vorulina)->orderBy('category_id')->orderBy('order')->get(); $data['pagetitle'] = $collections[$vorulina]['title']; return view('frontend.products')->with($data); } return redirect()->to('/vefverslun/'); }
</nav> </div> @if(frontpage()) <div class="Front"> <ul class="uk-slideshow" data-uk-slideshow="{autoplay:true}"> <li style="background-image: url('/img/big.jpg');" width="" height="" alt=""></li> </ul> </div> <div class="Lengja"> <h3 data-uk-scrollspy="{cls:'uk-animation-fade', delay:900}">Hjá SIGN eru hannaðir og smíðaðir fallegir skartgripir sem gjarnan endurspegla það fallega og dulræna sem býr í íslenskri náttúru.</h3> </div> <?php $collections = \App\Product::collections(); ?> <div class="Boxes"> <div class="uk-grid uk-grid-collapse uk-grid-match" data-uk-grid-match="{target:'.Box'}"> @foreach($collections as $key => $collection) <div class="uk-width-large-1-3 uk-width-small-1-2"> <div class="Box Box--shaded" style="background-image: url('/imagecache/large/{{ $collection['image'] }}')"> <div class="Box--content"> <div class="uk-flex uk-flex-center uk-flex-middle uk-height-1-1 uk-flex-column"> <h2>{{ $collection['title'] }}</h2> <a href="/vefverslun/vorulina/{{ $key }}" class="fancy-takki takki--contrast">Skoða</a> </div> </div> </div> </div> @endforeach