1 | <?php |
||
8 | class Input extends Component |
||
9 | { |
||
10 | public $type; |
||
11 | public $name; |
||
12 | public $placeholder; |
||
13 | public $label; |
||
14 | public $value; |
||
15 | public $class; |
||
16 | public $readonly; |
||
17 | public $required; |
||
18 | public $checked; |
||
19 | public $icon; |
||
20 | |||
21 | public function __construct( |
||
22 | $type = 'text', |
||
23 | $name = null, |
||
24 | $placeholder = null, |
||
25 | $label = null, |
||
26 | $value = null, |
||
27 | $class = null, |
||
28 | $readonly = null, |
||
29 | $required = false, |
||
30 | $icon = null |
||
31 | ) |
||
32 | { |
||
33 | $this->type = $type; |
||
34 | $this->name = $name ?? str_replace('-', '_', Str::kebab($label)); |
||
35 | $this->placeholder = $placeholder ?? (!$name ? str_replace('-', '_', Str::kebab($label)) : ''); |
||
36 | $this->label = $label; |
||
37 | $this->value = old($this->name, ($value ?? '')); |
||
38 | $this->class = $class; |
||
39 | $this->readonly = $readonly; |
||
40 | $this->required = $required; |
||
41 | $this->icon = $icon; |
||
42 | } |
||
43 | |||
44 | public function render() |
||
48 | } |
||
49 |