+
$value)
+ {{ $attribute }}="{{ $value }}"
+ @endforeach
+ />
-
+
@@ -58,15 +65,10 @@
$value)
- {{ $attribute }}="{{ $value }}"
- @endforeach
- @endif
>
diff --git a/resources/views/layouts/field-group.blade.php b/resources/views/layouts/field-group.blade.php
index 233eba8327..9606271d0a 100644
--- a/resources/views/layouts/field-group.blade.php
+++ b/resources/views/layouts/field-group.blade.php
@@ -1,7 +1,7 @@
@if ($label)
-
+
{{ __($label) }}
@endif
@@ -12,7 +12,7 @@
@endif
@yield('field')
-
+
@if ($help)
@markdown($help)
diff --git a/src/Fields/Field.php b/src/Fields/Field.php
index 6cf6b30a64..4cfab9e3f6 100644
--- a/src/Fields/Field.php
+++ b/src/Fields/Field.php
@@ -5,21 +5,27 @@ namespace Filament\Fields;
use Illuminate\Support\Str;
class Field extends BaseField {
- public $name;
- public $label;
public $model;
- public $modelDirective;
- public $extraAttributes;
+ public $value;
+ public $label;
+ public $modelDirective = 'wire:model.defer';
+ public $extraAttributes = [];
protected $view;
- public function __construct($name)
+ public function __construct($model)
{
- $this->name = $name;
+ $this->model = $model;
}
- public static function make($name)
+ public static function make($model)
{
- return new static($name);
+ return new static($model);
+ }
+
+ public function value($value)
+ {
+ $this->value = $value;
+ return $this;
}
public function label($label)
@@ -28,10 +34,9 @@ class Field extends BaseField {
return $this;
}
- public function model($model, $directive = 'wire:model.defer')
+ public function modelDirective($modelDirective)
{
- $this->model = $model;
- $this->modelDirective = $directive;
+ $this->modelDirective = $modelDirective;
return $this;
}
diff --git a/src/Http/Livewire/Auth/ForgotPassword.php b/src/Http/Livewire/Auth/ForgotPassword.php
index e10300e47a..3b713e7c18 100644
--- a/src/Http/Livewire/Auth/ForgotPassword.php
+++ b/src/Http/Livewire/Auth/ForgotPassword.php
@@ -33,7 +33,6 @@ class ForgotPassword extends Component
Text::make('email')
->type('email')
->label('E-Mail Address')
- ->model('email')
->extraAttributes([
'required' => 'true',
'autofocus' => 'true',
diff --git a/src/Http/Livewire/Auth/Login.php b/src/Http/Livewire/Auth/Login.php
index b51f260690..87f909e760 100644
--- a/src/Http/Livewire/Auth/Login.php
+++ b/src/Http/Livewire/Auth/Login.php
@@ -44,7 +44,6 @@ class Login extends Component
Text::make('email')
->type('email')
->label('E-Mail Address')
- ->model('email')
->extraAttributes([
'required' => 'true',
'autocomplete' => 'email',
@@ -57,15 +56,13 @@ class Login extends Component
Text::make('password')
->type('password')
->label('Password')
- ->model('password')
->extraAttributes([
'required' => 'true',
'autocomplete' => 'current-password',
])
->hint('['.__('Forgot Your Password?').']('.route('filament.password.forgot').')'),
Checkbox::make('remember')
- ->label('Remember me')
- ->model('remember'),
+ ->label('Remember me'),
];
}
diff --git a/src/Http/Livewire/Auth/Register.php b/src/Http/Livewire/Auth/Register.php
index a1b07fd58d..9b0543a4e7 100644
--- a/src/Http/Livewire/Auth/Register.php
+++ b/src/Http/Livewire/Auth/Register.php
@@ -33,7 +33,6 @@ class Register extends Component
return [
Text::make('name')
->label('Name')
- ->model('name')
->extraAttributes([
'required' => 'true',
'autofocus' => 'true',
@@ -42,7 +41,7 @@ class Register extends Component
Text::make('email')
->type('email')
->label('E-Mail Address')
- ->model('email', 'wire:model.lazy')
+ ->modelDirective('wire:model.lazy')
->extraAttributes([
'required' => 'true',
'autocomplete' => 'email',
@@ -50,7 +49,6 @@ class Register extends Component
Text::make('password')
->type('password')
->label('Password')
- ->model('password',)
->extraAttributes([
'required' => 'true',
'autocomplete' => 'new-password',
@@ -58,7 +56,6 @@ class Register extends Component
Text::make('password_confirmation')
->type('password')
->label('Confirm New Password')
- ->model('password_confirmation',)
->extraAttributes([
'required' => 'true',
'autocomplete' => 'new-password',
diff --git a/src/Http/Livewire/Auth/ResetPassword.php b/src/Http/Livewire/Auth/ResetPassword.php
index 7fd51965cc..ceabf17bac 100644
--- a/src/Http/Livewire/Auth/ResetPassword.php
+++ b/src/Http/Livewire/Auth/ResetPassword.php
@@ -61,7 +61,7 @@ class ResetPassword extends Component
Text::make('email')
->type('email')
->label('E-Mail Address')
- ->model('email', 'wire:model.lazy')
+ ->modelDirective('wire:model.lazy')
->extraAttributes([
'required' => 'true',
'autocomplete' => 'email',
@@ -69,7 +69,6 @@ class ResetPassword extends Component
Text::make('password')
->type('password')
->label('Password')
- ->model('password',)
->extraAttributes([
'required' => 'true',
'autofocus' => 'true',
@@ -78,7 +77,6 @@ class ResetPassword extends Component
Text::make('password_confirmation')
->type('password')
->label('Confirm New Password')
- ->model('password_confirmation',)
->extraAttributes([
'required' => 'true',
'autocomplete' => 'new-password',
diff --git a/src/Http/Livewire/Profile.php b/src/Http/Livewire/Profile.php
index b2126922ea..7be27a27ba 100644
--- a/src/Http/Livewire/Profile.php
+++ b/src/Http/Livewire/Profile.php
@@ -82,23 +82,21 @@ class Profile extends Component
return [
Tabs::label('Profile')
->tab('Account', [
- Text::make('name')
+ Text::make('user.name')
->label('Name')
- ->model('user.name')
->extraAttributes([
'required' => 'true',
]),
- Text::make('email')
+ Text::make('user.email')
->type('email')
->label('E-Mail Address')
- ->model('user.email', 'wire:model.lazy')
+ ->modelDirective('wire:model.lazy')
->extraAttributes([
'required' => 'true',
'autocomplete' => 'email',
]),
Avatar::make('avatar')
->label('User Photo')
- ->model('avatar')
->avatar($this->avatar)
->user($this->user)
->delete('deleteAvatar')
@@ -108,7 +106,6 @@ class Profile extends Component
Text::make('password')
->type('password')
->label('Password')
- ->model('password',)
->extraAttributes([
'autocomplete' => 'new-password',
])
@@ -117,7 +114,6 @@ class Profile extends Component
Text::make('password_confirmation')
->type('password')
->label('Confirm New Password')
- ->model('password_confirmation',)
->extraAttributes([
'autocomplete' => 'new-password',
])