当前位置: 首页>>代码示例>>PHP>>正文


PHP Location::getSelectHierarchy方法代码示例

本文整理汇总了PHP中app\models\Location::getSelectHierarchy方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::getSelectHierarchy方法的具体用法?PHP Location::getSelectHierarchy怎么用?PHP Location::getSelectHierarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Location的用法示例。


在下文中一共展示了Location::getSelectHierarchy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: form

 /**
  * Returns a new form for the specified asset.
  *
  * @param Asset $asset
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function form(Asset $asset)
 {
     return $this->form->of('assets', function (FormGrid $form) use($asset) {
         if ($asset->exists) {
             $method = 'PATCH';
             $route = route('maintenance.assets.update', [$asset->getKey()]);
             $form->submit = 'Save';
         } else {
             $method = 'POST';
             $route = route('maintenance.assets.store');
             $form->submit = 'Create';
         }
         $categories = Category::getSelectHierarchy('assets');
         $locations = Location::getSelectHierarchy();
         $form->resource($this, $route, $asset, compact('method'));
         $form->fieldset(function (Fieldset $fieldset) use($categories, $locations) {
             $fieldset->control('input:text', 'tag')->attributes(['placeholder' => 'ex. 100010']);
             $fieldset->control('input:text', 'name')->attributes(['placeholder' => 'ex. Ford F150']);
             $fieldset->control('select', 'category')->options($categories)->value(function (Asset $asset) {
                 return $asset->category_id;
             });
             $fieldset->control('select', 'location')->options($locations)->value(function (Asset $asset) {
                 return $asset->location_id;
             });
             $fieldset->control('input:textarea', 'description');
             $fieldset->control('select', 'condition')->options(trans('assets.conditions'))->value(function (Asset $asset) {
                 return $asset->condition_number;
             });
             $fieldset->control('input:text', 'vendor')->attributes(['placeholder' => 'ex. Ford']);
             $fieldset->control('input:text', 'make')->attributes(['placeholder' => 'ex. F']);
             $fieldset->control('input:text', 'model')->attributes(['placeholder' => 'ex. 150']);
             $fieldset->control('input:text', 'serial')->attributes(['placeholder' => 'ex. 153423-13432432-2342423']);
             $fieldset->control('input:text', 'size')->attributes(['placeholder' => 'ex. 1905 x 2463']);
             $fieldset->control('input:text', 'weight')->attributes(['placeholder' => 'ex. 1 Ton']);
             $fieldset->control('input:text', 'acquired_at')->attributes(['class' => 'pickadate', 'placeholder' => 'Click to Select a Date']);
             $fieldset->control('input:text', 'end_of_life')->attributes(['class' => 'pickadate', 'placeholder' => 'Click to Select a Date']);
         });
     });
 }
开发者ID:stevebauman,项目名称:maintenance,代码行数:46,代码来源:AssetPresenter.php

示例2: form

 /**
  * Returns a new form for work orders.
  *
  * @param WorkOrder $workOrder
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function form(WorkOrder $workOrder)
 {
     return $this->form->of('work-orders', function (FormGrid $form) use($workOrder) {
         if ($workOrder->exists) {
             $method = 'PATCH';
             $url = route('maintenance.work-orders.update', [$workOrder->getKey()]);
             $form->submit = 'Save';
         } else {
             $method = 'POST';
             $url = route('maintenance.work-orders.store');
             $form->submit = 'Create';
         }
         $form->with($workOrder);
         $form->attributes(compact('method', 'url'));
         $form->fieldset(function (Fieldset $fieldset) {
             $fieldset->control('select', 'category')->value(function (WorkOrder $workOrder) {
                 return $workOrder->category_id;
             })->options(function () {
                 return Category::getSelectHierarchy('work-orders');
             });
             $fieldset->control('select', 'location')->value(function (WorkOrder $workOrder) {
                 return $workOrder->location_id;
             })->options(function () {
                 return Location::getSelectHierarchy();
             });
             $fieldset->control('select', 'status')->options(function () {
                 $statuses = Status::all()->pluck('name', 'id');
                 $statuses[0] = 'None';
                 return $statuses;
             });
             $fieldset->control('select', 'priority')->value(function (WorkOrder $workOrder) {
                 return $workOrder->priority_id;
             })->options(function () {
                 $priorities = Priority::all()->pluck('name', 'id');
                 $priorities[0] = 'None';
                 return $priorities;
             });
             $fieldset->control('select', 'assets[]')->label('Assets')->options(function () {
                 return Asset::all()->pluck('name', 'id');
             })->attributes(['class' => 'select2', 'multiple' => true]);
             $fieldset->control('input:text', 'subject')->attributes(['placeholder' => 'ex. Worked on HVAC']);
             $fieldset->control('input:textarea', 'description');
         });
     });
 }
开发者ID:stevebauman,项目名称:maintenance,代码行数:52,代码来源:WorkOrderPresenter.php

示例3: form

 /**
  * Returns a new form of the specified inventory stock.
  *
  * @param Inventory      $item
  * @param InventoryStock $stock
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function form(Inventory $item, InventoryStock $stock)
 {
     return $this->form->of('inventory.stocks', function (FormGrid $form) use($item, $stock) {
         if ($stock->exists) {
             $method = 'PATCH';
             $url = route('maintenance.inventory.stocks.update', [$item->getKey(), $stock->getKey()]);
             $form->submit = 'Save';
         } else {
             $method = 'POST';
             $url = route('maintenance.inventory.stocks.store', [$item->getKey()]);
             $form->submit = 'Create';
         }
         $locations = Location::getSelectHierarchy();
         $form->with($stock);
         $form->attributes(compact('method', 'url'));
         $form->fieldset(function (Fieldset $fieldset) use($locations) {
             $fieldset->control('select', 'location')->value(function (InventoryStock $stock) {
                 return $stock->location_id;
             })->options($locations);
             $fieldset->control('input:text', 'quantity')->attributes(['placeholder' => 'ex. 45']);
             $fieldset->control('input:text', 'reason')->attributes(['placeholder' => 'ex. Stock Update']);
             $fieldset->control('input:text', 'cost')->attributes(['placeholder' => 'ex. 15.00']);
         });
     });
 }
开发者ID:stevebauman,项目名称:maintenance,代码行数:33,代码来源:InventoryStockPresenter.php


注:本文中的app\models\Location::getSelectHierarchy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。