本文整理汇总了PHP中app\Product::product_types方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::product_types方法的具体用法?PHP Product::product_types怎么用?PHP Product::product_types使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Product
的用法示例。
在下文中一共展示了Product::product_types方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<div class="uk-form-row">
<label class="uk-form-label" for="status">Flokkur</label>
<div class="uk-form-controls">
{!! Form::select($item->parent_key, $flokkar, (isset($item->id) ? $item->{$item->parent_key} : isset($selectedFlokkurId) ? $selectedFlokkurId : 0)) !!}
</div>
</div>
<?php
$collections = \App\Product::collections();
$cols = ['' => ' - Veldu línu (ef á við) - '];
foreach ($collections as $key => $collection) {
$cols[$key] = $collection['title'];
}
$product_types = \App\Product::product_types();
?>
<div class="uk-form-row">
<label class="uk-form-label" for="collection">Collection (Vörulína)</label>
<div class="uk-form-controls">
{!! Form::select('collection', $cols, (isset($item->collection) ? $item->collection : '')) !!}
</div>
</div>
<div class="uk-form-row">
<label class="uk-form-label" for="product_type">Tegund vöru</label>
<div class="uk-form-controls">
{!! Form::select('product_type', $product_types, (isset($item->product_type) ? $item->product_type : '')) !!}
<br><small>Þetta segir til um hvaða vöruvalmöguleikar eru fyrirfram ákveðnir.</small>
</div>
</div>
<div class="uk-form-row">
示例2: 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);
}