當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Product::product_types方法代碼示例

本文整理匯總了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">
開發者ID:stjanilofts,項目名稱:sign,代碼行數:31,代碼來源:_form.blade.php

示例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);
 }
開發者ID:stjanilofts,項目名稱:sign,代碼行數:27,代碼來源:DatabaseSeeder.php


注:本文中的app\Product::product_types方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。