Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bb99be750 | ||
|
|
42455e4f69 | ||
|
|
7ec9bb06ed | ||
|
|
308de02173 | ||
|
|
b43878dbce | ||
|
|
92b6655218 | ||
|
|
5ef9a3c9ae | ||
|
|
d2910a7a97 | ||
|
|
895115187e | ||
|
|
240cfcfd31 | ||
|
|
f622d996df | ||
|
|
d4c632dc5c | ||
|
|
8d18ac6a68 | ||
|
|
ae9f533f99 | ||
|
|
64f2268bf4 | ||
|
|
0cf70cc073 | ||
|
|
6906174183 | ||
|
|
c44b222756 | ||
|
|
eed5d939e8 | ||
|
|
9d45eb1cc1 | ||
|
|
bcc317d21a | ||
|
|
5f419d476d |
No files matched your search
@@ -5,3 +5,4 @@
|
||||
.travis.yml export-ignore
|
||||
phpunit.php export-ignore
|
||||
phpunit.xml export-ignore
|
||||
LaravelCollectiveHTML-banner.png export-ignore
|
||||
+7
-7
@@ -18,15 +18,15 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2",
|
||||
"illuminate/http": "6.0.*",
|
||||
"illuminate/routing": "6.0.*",
|
||||
"illuminate/session": "6.0.*",
|
||||
"illuminate/support": "6.0.*",
|
||||
"illuminate/view": "6.0.*"
|
||||
"php": ">=7.2.5",
|
||||
"illuminate/http": "^6.0|^7.0|^8.0",
|
||||
"illuminate/routing": "^6.0|^7.0|^8.0",
|
||||
"illuminate/session": "^6.0|^7.0|^8.0",
|
||||
"illuminate/support": "^6.0|^7.0|^8.0",
|
||||
"illuminate/view": "^6.0|^7.0|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/database": "6.0.*",
|
||||
"illuminate/database": "^6.0|^7.0|^8.0",
|
||||
"mockery/mockery": "~1.0",
|
||||
"phpunit/phpunit": "~7.1"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||

|
||||
|
||||
[](https://travis-ci.org/LaravelCollective/html)
|
||||
[](https://packagist.org/packages/laravelcollective/html)
|
||||
[](https://packagist.org/packages/laravelcollective/html)
|
||||
[](https://packagist.org/packages/laravelcollective/html)
|
||||
[](https://packagist.org/packages/laravelcollective/html)
|
||||
|
||||
A documentação oficial para Forms & Html para o framework Laravel podem ser encontrados no site [LaravelCollective](https://laravelcollective.com/docs).
|
||||
+8
-2
@@ -1201,7 +1201,13 @@ class FormBuilder
|
||||
protected function getRouteAction($options)
|
||||
{
|
||||
if (is_array($options)) {
|
||||
return $this->url->route($options[0], array_slice($options, 1));
|
||||
$parameters = array_slice($options, 1);
|
||||
|
||||
if (array_keys($options) === [0, 1]) {
|
||||
$parameters = head($parameters);
|
||||
}
|
||||
|
||||
return $this->url->route($options[0], $parameters);
|
||||
}
|
||||
|
||||
return $this->url->route($options);
|
||||
@@ -1360,7 +1366,7 @@ class FormBuilder
|
||||
return $this->model->getFormValue($key);
|
||||
}
|
||||
|
||||
return data_get($this->model, $this->transformKey($name));
|
||||
return data_get($this->model, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+17
-10
@@ -171,12 +171,13 @@ class HtmlBuilder
|
||||
* @param string $url
|
||||
* @param string $title
|
||||
* @param array $attributes
|
||||
* @param bool $escape
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function secureLink($url, $title = null, $attributes = [])
|
||||
public function secureLink($url, $title = null, $attributes = [], $escape = true)
|
||||
{
|
||||
return $this->link($url, $title, $attributes, true);
|
||||
return $this->link($url, $title, $attributes, true, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,14 +187,15 @@ class HtmlBuilder
|
||||
* @param string $title
|
||||
* @param array $attributes
|
||||
* @param bool $secure
|
||||
* @param bool $escape
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function linkAsset($url, $title = null, $attributes = [], $secure = null)
|
||||
public function linkAsset($url, $title = null, $attributes = [], $secure = null, $escape = true)
|
||||
{
|
||||
$url = $this->url->asset($url, $secure);
|
||||
|
||||
return $this->link($url, $title ?: $url, $attributes, $secure);
|
||||
return $this->link($url, $title ?: $url, $attributes, $secure, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,12 +204,13 @@ class HtmlBuilder
|
||||
* @param string $url
|
||||
* @param string $title
|
||||
* @param array $attributes
|
||||
* @param bool $escape
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function linkSecureAsset($url, $title = null, $attributes = [])
|
||||
public function linkSecureAsset($url, $title = null, $attributes = [], $escape = true)
|
||||
{
|
||||
return $this->linkAsset($url, $title, $attributes, true);
|
||||
return $this->linkAsset($url, $title, $attributes, true, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,12 +220,14 @@ class HtmlBuilder
|
||||
* @param string $title
|
||||
* @param array $parameters
|
||||
* @param array $attributes
|
||||
* @param bool $secure
|
||||
* @param bool $escape
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function linkRoute($name, $title = null, $parameters = [], $attributes = [])
|
||||
public function linkRoute($name, $title = null, $parameters = [], $attributes = [], $secure = null, $escape = true)
|
||||
{
|
||||
return $this->link($this->url->route($name, $parameters), $title, $attributes);
|
||||
return $this->link($this->url->route($name, $parameters), $title, $attributes, $secure, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,12 +237,14 @@ class HtmlBuilder
|
||||
* @param string $title
|
||||
* @param array $parameters
|
||||
* @param array $attributes
|
||||
* @param bool $secure
|
||||
* @param bool $escape
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function linkAction($action, $title = null, $parameters = [], $attributes = [])
|
||||
public function linkAction($action, $title = null, $parameters = [], $attributes = [], $secure = null, $escape = true)
|
||||
{
|
||||
return $this->link($this->url->action($action, $parameters), $title, $attributes);
|
||||
return $this->link($this->url->action($action, $parameters), $title, $attributes, $secure, $escape);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-4
@@ -10,7 +10,7 @@ if (! function_exists('link_to')) {
|
||||
* @param bool $secure
|
||||
* @param bool $escape
|
||||
*
|
||||
* @return string
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
function link_to($url, $title = null, $attributes = [], $secure = null, $escape = true)
|
||||
{
|
||||
@@ -27,7 +27,7 @@ if (! function_exists('link_to_asset')) {
|
||||
* @param array $attributes
|
||||
* @param bool $secure
|
||||
*
|
||||
* @return string
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
function link_to_asset($url, $title = null, $attributes = [], $secure = null)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ if (! function_exists('link_to_route')) {
|
||||
* @param array $parameters
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
function link_to_route($name, $title = null, $parameters = [], $attributes = [])
|
||||
{
|
||||
@@ -61,7 +61,7 @@ if (! function_exists('link_to_action')) {
|
||||
* @param array $parameters
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
function link_to_action($action, $title = null, $parameters = [], $attributes = [])
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ use Collective\Html\FormBuilder;
|
||||
use Collective\Html\HtmlBuilder;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Routing\RouteCollection;
|
||||
use Illuminate\Routing\UrlGenerator;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -99,6 +100,24 @@ class FormBuilderTest extends PHPUnit\Framework\TestCase
|
||||
$form5);
|
||||
}
|
||||
|
||||
public function testFormRoute()
|
||||
{
|
||||
$routes = new RouteCollection();
|
||||
$routes->get('user/{id}');
|
||||
$routes->add(new Route(['GET'], 'user/{id}', ['as' => 'user.show']));
|
||||
$this->urlGenerator->setRoutes($routes);
|
||||
|
||||
$form1 = $this->formBuilder->open(['method' => 'GET', 'route' => ['user.show', 1, 'foo' => 'bar']]);
|
||||
$form2 = $this->formBuilder->open(['method' => 'GET', 'route' => ['user.show', 'id' => 2, 'foo' => 'bar']]);
|
||||
$form3 = $this->formBuilder->open(['method' => 'GET', 'route' => ['user.show', [3, 'foo' => 'bar']]]);
|
||||
$form4 = $this->formBuilder->open(['method' => 'GET', 'route' => ['user.show', ['id' => 4, 'foo' => 'bar']]]);
|
||||
|
||||
$this->assertEquals('<form method="GET" action="http://localhost/user/1?foo=bar" accept-charset="UTF-8">', $form1);
|
||||
$this->assertEquals('<form method="GET" action="http://localhost/user/2?foo=bar" accept-charset="UTF-8">', $form2);
|
||||
$this->assertEquals('<form method="GET" action="http://localhost/user/3?foo=bar" accept-charset="UTF-8">', $form3);
|
||||
$this->assertEquals('<form method="GET" action="http://localhost/user/4?foo=bar" accept-charset="UTF-8">', $form4);
|
||||
}
|
||||
|
||||
public function testClosingForm()
|
||||
{
|
||||
$this->assertEquals('</form>', $this->formBuilder->close());
|
||||
|
||||
Reference in new issue
Block a user