1 | <?php |
||
12 | class Former implements Contract |
||
13 | { |
||
14 | /** |
||
15 | * The FormerHelper instance. |
||
16 | * |
||
17 | * @var HelperContract |
||
18 | */ |
||
19 | private $helper; |
||
20 | |||
21 | /** |
||
22 | * FormFactory constructor. |
||
23 | * |
||
24 | * @param HelperContract $helper |
||
25 | */ |
||
26 | public function __construct(HelperContract $helper) |
||
30 | |||
31 | /** |
||
32 | * Make a form instance by using the rules. |
||
33 | * |
||
34 | * @param array $formRules |
||
35 | * @param Model|null $model |
||
36 | * @param array $types |
||
37 | * @return Form |
||
38 | */ |
||
39 | public function make(array $formRules, Model $model = null, array $types = []) |
||
59 | |||
60 | |||
61 | /** |
||
62 | * Make a form instance by using the form request. |
||
63 | * |
||
64 | * @param $formRequest |
||
65 | * @param Model $model |
||
66 | * @param array $types |
||
67 | * @return Form |
||
68 | */ |
||
69 | public function makeFromRequest($formRequest, Model $model, array $types = []) |
||
75 | |||
76 | /** |
||
77 | * Get input class by rules and types for a field. |
||
78 | * |
||
79 | * @param string $name |
||
80 | * @param string[] $rules |
||
81 | * @param string[] $types |
||
82 | * @return string |
||
83 | */ |
||
84 | protected function getInputByRulesAndTypes($name, $rules, $types) |
||
92 | } |
||
93 |