本文整理匯總了PHP中app\Product::collections方法的典型用法代碼示例。如果您正苦於以下問題:PHP Product::collections方法的具體用法?PHP Product::collections怎麽用?PHP Product::collections使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Product
的用法示例。
在下文中一共展示了Product::collections方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: makeProduct
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);
}
示例2: vorulina
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/');
}
示例3: url
</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