本文整理汇总了PHP中Kris\LaravelFormBuilder\FormBuilder类的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilder类的具体用法?PHP FormBuilder怎么用?PHP FormBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FormBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formUserDetail
/**
*
* @return \Kris\LaravelFormBuilder\Form
*/
private function formUserDetail()
{
$formUserDetail = $this->formBuilder->create('App\\Http\\Forms\\UserDetailForm', ['method' => 'PUT', 'url' => route('user.details.store'), 'model' => $this->userDetail]);
$formUserDetail->modify('avatar', 'file', ['value' => '']);
$formUserDetail->add('submit', 'submit', ['label' => 'Change your user details', 'attr' => ['class' => 'btn btn-primary btn-block']]);
return $formUserDetail;
}
示例2: show
/**
* Display the specified Blacklist Domain.
*
* @param BlacklistDomain $blacklistDomain
* @param FormBuilder $formBuilder
* @return Response
*/
public function show(BlacklistDomain $blacklistDomain, FormBuilder $formBuilder)
{
if ($blacklistDomain->zone_id) {
$zoneName = $blacklistDomain->zone->name;
} else {
$zoneName = trans('admin.blacklist_domain.global');
}
$form = $formBuilder->create('Admin\\BlacklistDomainForm', ['model' => $blacklistDomain])->add('zone_name', 'text', ['label' => trans('admin.blacklist_domain.field_zone_name'), 'default_value' => $zoneName, 'attr' => ['disabled' => 'disabled']]);
return view('admin.blacklist-domain.show', compact('form'));
}
示例3: edit
public function edit($id, FormBuilder $formBuilder)
{
$result = IndustryType::findOrFail($id);
$form = $formBuilder->create('employment_bank\\Forms\\IndustryTypeForm', ['method' => 'PUT', 'model' => $result, 'url' => route($this->route . 'update', $id)])->remove('save');
//->setData('market_values', $markets);
return view($this->content . 'edit', compact('form'));
}
示例4: edit
/**
* Show the form for editing the specified article.
*
* @param Article $article
* @param FormBuilder $formBuilder
* @return Response
*/
public function edit(Article $article, FormBuilder $formBuilder)
{
$language = Session::get('current_lang');
$categories = $language->categories->lists('title', 'id')->all();
$form = $formBuilder->create('App\\Forms\\ArticlesForm', ['method' => 'PATCH', 'url' => route('admin.article.update', ['id' => $article->id]), 'model' => $article], $categories);
return view('admin.articles.edit', compact('form', 'article'));
}
示例5: edit
public function edit($id, Request $request, FormBuilder $formBuilder)
{
$permission = $this->permission->find($id);
$form = $formBuilder->create('App\\Forms\\PermissionForm', ['model' => $permission, 'method' => 'PUT', 'url' => route('admin.permissions.update', $id)]);
$script = 'js/backend/access/permissions/dependencies/script.js';
return view($request->ajax() ? 'layout.partials.ajax_form' : 'layout.partials.form', compact('form', 'script'));
}
示例6: store
public function store(FormBuilder $formBuilder)
{
$form = $formBuilder->create('App\\Forms\\SongForm');
if (!$form->isValid()) {
return redirect()->back()->withErrors($form->getErrors())->withInput();
}
// Do saving and other things...
}
示例7: it_appends_default_namespace_from_config_on_building
/** @test */
public function it_appends_default_namespace_from_config_on_building()
{
$form = new LaravelFormBuilderTest\Forms\NamespacedDummyForm();
$config = $this->config;
$config['default_namespace'] = 'LaravelFormBuilderTest\\Forms';
$formHelper = new FormHelper($this->view, $this->translator, $config);
$formBuilder = new FormBuilder($this->app, $formHelper);
$formBuilder->create('NamespacedDummyForm');
}
示例8: create
public function create(FormBuilder $formBuilder, $groupId = null)
{
$orgModel = [];
if (null !== $groupId) {
$orgModel = $this->orgGroupManager->getModelForUpdate($groupId);
}
$form = $formBuilder->create('App\\SuperAdmin\\Forms\\OrganizationGroup', ['method' => null !== $groupId ? 'PUT' : 'POST', 'url' => null !== $groupId ? route('admin.edit-group', [$groupId]) : route('admin.create-organization-group'), 'model' => $groupId ? $orgModel : null]);
return view('superAdmin.groupOrganization.create', compact('form', 'groupId'));
}
示例9: defaultEdit
/**
* Render the form to $view when edit a record
*
* @param FormBuilder $formBuilder
* @param Model $model
* @param string $formName
* @param string $view
* @param string $modelName
* @return Response
*/
protected function defaultEdit(FormBuilder $formBuilder, Model $model, $formName, $view, $modelName = null)
{
$form = $formBuilder->create($formName, ['method' => 'PUT', 'url' => $this->route(explode('.', $view)[1] . '.update', ['id' => $model->id]), 'model' => $model]);
if ($modelName) {
return view($view, ['form' => $form, $modelName => $model]);
} else {
return view($view, compact('form'));
}
}
示例10: store
public function store(FormBuilder $formBuilder, Request $request)
{
$form = $formBuilder->create(AdvertsForm::class);
if (!$form->isValid()) {
return redirect()->back()->withErrors($form->getErrors())->withInput();
}
Adverts::create($request->all());
return redirect()->route('advert.index');
}
示例11: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request, FormBuilder $formBuilder, $page = null)
{
$applicationBySubjectList = new ApplicationBySubjectList($request, $this->main_page, $page);
$keys = $applicationBySubjectList->getKeys();
$data_arr = $applicationBySubjectList->getDataArr();
$paginationForm = $applicationBySubjectList->getPaginationForm();
$filter = session('application_by_subject_filter');
$form_filter = $formBuilder->create('App\\Filters\\ApplicationBySubjectFilter', ['method' => 'PATCH', 'action' => ['ApplicationBySubjectController@index'], 'model' => $filter, 'class' => 'form-inline']);
return view('list', ['controller' => 'ApplicationBySubjectController', 'data_arr' => $data_arr, 'keys' => $keys, 'perm_path' => $this->main_page, 'path' => $this->main_page, 'title' => 'APPLICATION_BY_SUBJECTS', 'filter' => $form_filter, 'pagination' => $paginationForm, 'add' => false, 'additional_info' => false, 'back' => false, 'parent_table_id' => false, 'edit' => false, 'delete' => false, 'modal' => true]);
}
示例12: store
public function store(FormBuilder $formBuilder, Request $request)
{
$form = $formBuilder->create(StatesForm::class);
// It will automatically use current request, get the rules, and do the validation
if (!$form->isValid()) {
return redirect()->back()->withErrors($form->getErrors())->withInput();
}
States::create($request->all());
return redirect()->route('state.index');
}
示例13: add
/**
* Show the form required by an ajax request.
*
* @param $parent
* @param FormBuilder $formBuilder
*
* @return \Illuminate\Http\Response
*/
public function add(FormBuilder $formBuilder, $parent)
{
$articleComment = ArticleComment::whereId($parent)->get(['article_id'])->first();
$slug = Article::whereId($articleComment->article_id)->get(['slug'])->first();
$form = $formBuilder->create('\\App\\Http\\Forms\\ArticleCommentForm', ['method' => 'POST', 'id' => 'article_comment_form', 'url' => route('articles.comment.store')]);
$form->add('slug', 'hidden', ['value' => $slug->slug, 'attr' => ['id' => 'slug']]);
$form->add('parent_id', 'hidden', ['value' => $parent, 'attr' => ['id' => 'parent_id']]);
$form->add('save', 'submit', ['label' => 'Add your comment']);
return response()->view('articles.ajax_article_comment_show', compact('form'));
}
示例14: update
public function update($id, FormBuilder $formBuilder, Request $request)
{
$good = Goods::findOrFail($id);
$form = $formBuilder->create(GoodsForm::class);
// It will automatically use current request, get the rules, and do the validation
if (!$form->isValid()) {
return redirect()->back()->withErrors($form->getErrors())->withInput();
}
$good->update($request->all());
return redirect()->route('good.index');
}
示例15: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id, FormBuilder $formBuilder)
{
$course_arr = [];
$course = CourseQuery::create()->findPK($id);
$course_arr = $course->toArray();
$form = $formBuilder->create('App\\Forms\\CourseForm', ['method' => 'PATCH', 'action' => ['CourseController@update', $id], 'model' => $course_arr]);
$form_name = 'COURSE';
$action = 'EDIT_OBJ';
$path = $this->main_page;
session(['attribute' => \Lang::get('general.COURSE')]);
return view('manage', compact('form', 'form_name', 'action', 'path'));
}