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


PHP FormBuilder::model方法代码示例

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


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

示例1: model

 /**
  * Open a form configured for model binding.
  *
  * @param  array  $options
  * @return string
  */
 protected function model($options)
 {
     $model = $options['model'];
     if (isset($options['url'])) {
         // If we're explicity passed a URL, we'll use that.
         array_forget($options, ['update', 'store']);
         $options['method'] = isset($options['method']) ? $options['method'] : 'GET';
         return $this->form->model($model, $options);
     }
     if (!is_null($options['model']) && $options['model']->exists) {
         // If the form is passed a model, we'll use the update route to update
         // the model using the PUT method.
         $route = Str::contains($options['update'], '@') ? 'action' : 'route';
         $options[$route] = [$options['update'], $options['model']->getRouteKey()];
         $options['method'] = 'PUT';
     } else {
         // Otherwise, we're storing a brand new model using the POST method.
         $route = Str::contains($options['store'], '@') ? 'action' : 'route';
         $options[$route] = $options['store'];
         $options['method'] = 'POST';
     }
     // Forget the routes provided to the input.
     array_forget($options, ['model', 'update', 'store']);
     return $this->form->model($model, $options);
 }
开发者ID:mitris,项目名称:bootstrap-form,代码行数:31,代码来源:BootstrapForm.php

示例2: model

 public function model($model, array $options = array())
 {
     // always set up validation, whether output by this tag or not
     $this->_setUpValidation($model, $options);
     // set up form ID
     if (array_key_exists('validate', $options) && $options['validate']) {
         $this->npmValidate = true;
     }
     // pass to parent
     $this->npmModel = $model;
     $results = parent::model($model, $options);
     if (Generator::START == $this->gen->getCodePosition()) {
         $results .= $this->generateClientValidatorCode();
     }
     return $results;
 }
开发者ID:bignerdranch,项目名称:client-validation-generator,代码行数:16,代码来源:FormBuilder.php

示例3: model

 /**
  * Open a form configured for model binding.
  *
  * @param  array  $options
  * @return string
  */
 protected function model($options)
 {
     $model = $options['model'];
     // If the form is passed a model, we'll use the update route to update
     // the model using the PUT method.
     if (!is_null($options['model']) && $options['model']->exists) {
         $update = is_array($options['update']) ? $options['update'][0] : $options['update'];
         $route = Str::contains($update, '@') ? 'action' : 'route';
         $options[$route] = array_merge((array) $options['update'], [$options['model']->getRouteKey()]);
         $options['method'] = 'PUT';
     } else {
         // Otherwise, we're storing a brand new model using the POST method.
         $store = is_array($options['store']) ? $options['store'][0] : $options['store'];
         $route = Str::contains($store, '@') ? 'action' : 'route';
         $options[$route] = $options['store'];
         $options['method'] = 'POST';
     }
     // Forget the routes provided to the input.
     array_forget($options, ['model', 'update', 'store']);
     return $this->form->model($model, $options);
 }
开发者ID:DODMax,项目名称:bootstrap-form,代码行数:27,代码来源:BootstrapForm.php

示例4: model

 /**
  * Create a new model based form builder.
  *
  * @param mixed $model
  * @param array $options
  * @return string 
  * @static 
  */
 public static function model($model, $options = array())
 {
     return \Collective\Html\FormBuilder::model($model, $options);
 }
开发者ID:alvarobfdev,项目名称:BaseCRUDproject,代码行数:12,代码来源:_ide_helper.php

示例5: model

 /**
  * Create a new model based form builder.
  * @param \LaravelArdent\Ardent\Ardent $model An Ardent model instance. Validation rules will be taken from it
  * @param array                        $options
  * @return string
  * @see Collective\Html\FormBuilder
  */
 public function model($model, array $options = [])
 {
     $this->setValidation($model::$rules);
     return parent::model($model, $options);
 }
开发者ID:laravel-ardent,项目名称:laravalid,代码行数:12,代码来源:FormBuilder.php

示例6: model

 /**
  * Create a new model based form builder.
  *
  * @param array $rules 		Laravel validation rules
  *
  * @see Illuminate\Html\FormBuilder
  */
 public function model($model, array $options = array(), $rules = null)
 {
     $this->setValidation($rules);
     return parent::model($model, $options);
 }
开发者ID:PaulSpr,项目名称:laravalid,代码行数:12,代码来源:FormBuilder.php

示例7: model

 public function model($model, array $options = [])
 {
     $this->initializeForm($options);
     return parent::model($model, $options);
 }
开发者ID:genealabs,项目名称:laravel-casts,代码行数:5,代码来源:FormBuilder.php


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