Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added seach() method to FormBuilder #333

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/FormBuilder.php → src/function hidden
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,20 @@ public function hidden($name, $value = null, $options = [])
return $this->input('hidden', $name, $value, $options);
}

/**
* Create a search input field.
*
* @param string $name
* @param string $value
* @param array $options
*
* @return \Illuminate\Support\HtmlString
*/
public function search($name, $value = null, $options = [])
{
return $this->input('search', $name, $value, $options);
}

/**
* Create an e-mail input field.
*
Expand Down
11 changes: 11 additions & 0 deletions tests/FormBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ public function testFormHidden()
$this->assertEquals('<input class="span2" name="foo" type="hidden">', $form3);
}

public function testFormSearch()
{
$form1 = $this->formBuilder->search('foo');
$form2 = $this->formBuilder->search('foo', 'foobar');
$form3 = $this->formBuilder->search('foo', null, ['class' => 'span2']);

$this->assertEquals('<input name="foo" type="search">', $form1);
$this->assertEquals('<input name="foo" type="search" value="foobar">', $form2);
$this->assertEquals('<input class="span2" name="foo" type="search">', $form3);
}

public function testFormEmail()
{
$form1 = $this->formBuilder->email('foo');
Expand Down