diff --git a/app/View/Components/Private/Forms/Form.php b/app/View/Components/Private/Forms/Form.php new file mode 100644 index 0000000..f4fd689 --- /dev/null +++ b/app/View/Components/Private/Forms/Form.php @@ -0,0 +1,32 @@ +requestName)) { + return $this->requestName; + } + + $this->requestName = Str::of($this->getName()) + ->replace( + ['.', '[', ']'], + ['_', '.', ''], + ) + ->rtrim('.') + ->value(); + + return $this->requestName; + } +} diff --git a/app/View/Components/Private/Forms/Input.php b/app/View/Components/Private/Forms/Input.php new file mode 100644 index 0000000..2e3c0af --- /dev/null +++ b/app/View/Components/Private/Forms/Input.php @@ -0,0 +1,50 @@ +name; + } + + protected function getTitle(): string + { + return Str::ucfirst($this->title); + } + + protected function getType(): string + { + return $this->type; + } + + protected function getValue(): string + { + return (string) old($this->getRequestName(), $this->value); + } + + /** + * @inheritDoc + */ + public function render(): View + { + return view('private.components.forms.input', [ + 'title' => $this->getTitle(), + 'name' => $this->getName(), + 'requestName' => $this->getRequestName(), + 'type' => $this->getType(), + 'value' => $this->getValue() + ]); + } +} diff --git a/resources/views/private/components/forms/input.blade.php b/resources/views/private/components/forms/input.blade.php new file mode 100644 index 0000000..2550e3a --- /dev/null +++ b/resources/views/private/components/forms/input.blade.php @@ -0,0 +1,7 @@ +