本文整理匯總了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);
}