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


PHP FormBuilder::create方法代码示例

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


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

示例1: profile

 /**
  * Show the user profile.
  *
  * @return Response
  */
 public function profile()
 {
     try {
         $user = User::with('groups')->findOrFail(Auth::user()->id);
         Debugbar::info($user->toArray());
         $user_form = \FormBuilder::create('Isabry\\Gatekeeper\\Forms\\UserForm', ['model' => $user])->remove('password')->remove('password_confirmation');
         return view('gatekeeper::home.profile')->with(compact('user_form'))->with('user', $user);
     } catch (ModelNotFoundException $e) {
         Session::flash('error', 'User not found (id: ' . $id . ')');
         return Redirect::intended('/');
     }
 }
开发者ID:isabry,项目名称:admin-laravel,代码行数:17,代码来源:HomeController.php

示例2: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $class = $this->params['model'];
     $entry = $class::find($id);
     $form = \FormBuilder::create($this->params['form'], ['method' => 'PUT', 'model' => $entry, 'url' => route("{$this->params['route']}.update", [$id]), 'data' => $this->params['form_data']]);
     $tplPath = base_path('resources/views/' . $this->params['tpl_path']);
     if (is_dir($tplPath)) {
         $view = "{$this->params['tpl_path']}.edit";
     } else {
         $view = 'crud::entry.edit';
     }
     return view($view, compact('form'));
 }
开发者ID:shalkam,项目名称:crud-generator,代码行数:19,代码来源:BaseController.php

示例3: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     try {
         $user = User::with('groups')->findOrFail($id);
         Debugbar::info($user->toArray());
         $user_form = \FormBuilder::create('Isabry\\Gatekeeper\\Forms\\UserForm', ['model' => $user])->remove('password')->remove('password_confirmation');
         $url = '<a role="button" href="' . route('users.index') . '" class="btn btn-primary">' . '  <i class="fa fa-mail-reply"></i> Back to Users List' . '</a>';
         return view('gatekeeper::users.view')->with('title', 'User (' . $user->name . ')')->with(compact('user_form'))->with('url', $url);
     } catch (ModelNotFoundException $e) {
         Session::flash('error', 'User not found (id: ' . $id . ')');
         return Redirect::intended('users');
     }
 }
开发者ID:isabry,项目名称:admin-laravel,代码行数:19,代码来源:UsersController.php

示例4: attributes

 /**
  * Attributes name from field label
  *
  * @return [string]
  */
 public function attributes()
 {
     if ($this->form) {
         $attributes = [];
         $formFields = \FormBuilder::create($this->form)->getFields();
         foreach ($formFields as $name => $fields) {
             if ($fields->getOptions()['label']) {
                 $attributes[$name] = $fields->getOptions()['label'];
             }
         }
         return $attributes;
     }
     return [];
 }
开发者ID:adhikjoshi,项目名称:D-provider,代码行数:19,代码来源:Request.php


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