diff --git a/app/View/Components/Field.php b/app/View/Components/Field.php index 925f8f5..885cde8 100644 --- a/app/View/Components/Field.php +++ b/app/View/Components/Field.php @@ -3,6 +3,7 @@ namespace App\View\Components; use Illuminate\Contracts\Translation\Translator; +use Illuminate\Support\Str; use Illuminate\View\Component; class Field extends Component @@ -53,7 +54,10 @@ public function label() return $this->translator->get('validation.attributes.'.$this->name); } - return ucfirst(str_replace('_', ' ', $this->name)); + return Str::of($this->name) + ->ucfirst() + ->replace('_', ' ') + ->finish(':'); } /** diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 287c34e..0fe2e34 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -147,7 +147,6 @@ */ 'attributes' => [ - 'email_address' => 'The Email Address' ], ]; diff --git a/resources/views/components/form.blade.php b/resources/views/components/form.blade.php new file mode 100644 index 0000000..49fa436 --- /dev/null +++ b/resources/views/components/form.blade.php @@ -0,0 +1,13 @@ +@props(['method']) + +
merge(['class' => 'form']) }}> + @if ($method != 'get') + @csrf + @endif + + @if (in_array(strtolower($method), ['put', 'patch', 'delete'])) + @method($method) + @endif + + {{ $slot }} +
diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 86b35c7..1173204 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -13,7 +13,9 @@
- + + +