Completed
Pull Request — master (#36)
by Rick
02:24
created

Form::action()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Spatie\Html\Elements;
4
5
use Spatie\Html\BaseElement;
6
use Illuminate\Support\Traits\Macroable;
7
8
class Form extends BaseElement
9
{
10
    use Macroable;
11
12
    protected $tag = 'form';
13
14
    /**
15
     * @param string|null $action
16
     *
17
     * @return static
18
     */
19
    public function action($action)
20
    {
21
        return $this->attribute('action', $action);
22
    }
23
24
    /**
25
     * @param string|null $method
26
     *
27
     * @return static
28
     */
29
    public function method($method)
30
    {
31
        return $this->attribute('method', $method);
32
    }
33
34
    /**
35
     * @return static
36
     */
37
    public function acceptsFiles()
38
    {
39
        return $this->attribute('enctype', 'multipart/form-data');
40
    }
41
42
    /**
43
     * @param string $route
44
     * @param array $parameters
45
     *
46
     * @return static
47
     */
48
    public function route($route, $parameters = [])
49
    {
50
        return $this->action(app('url')->route($route, $parameters));
51
    }
52
}
53