跳到主要内容
版本:5.x

Text input

简介​

文本输入(TextInput)字段允许你与字符串进行交互:

use Filament\Forms\Components\TextInput;

TextInput::make('name')
Text input

设置 HTML input 类型​

你可以使用一系列方法设置字符串类型。比如,email(),它同时也提供了相应的验证:

use Filament\Forms\Components\TextInput;

TextInput::make('text')
->email() // or
->numeric() // or
->integer() // or
->password() // or
->tel() // or
->url()

你也可以使用 type() 方法,并传入一个 HTML Input 类型:

use Filament\Forms\Components\TextInput;

TextInput::make('backgroundColor')
->type('color')
Text input with color type

各个类型方法还允许你传入布尔值来控制字段是否应该使用该类型:

use Filament\Forms\Components\TextInput;

TextInput::make('text')
->email(FeatureFlag::active()) // or
->numeric(FeatureFlag::active()) // or
->integer(FeatureFlag::active()) // or
->password(FeatureFlag::active()) // or
->tel(FeatureFlag::active()) // or
->url(FeatureFlag::active())
除了允许静态值之外,这些方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

设置 HTML input 模式​

使用 inputMode() 方法,你可以设置输入框的 inputmode 属性:

use Filament\Forms\Components\TextInput;

TextInput::make('text')
->numeric()
->inputMode('decimal')
除了允许静态值之外,inputMode() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

设置数值步长​

使用 step() 方法,你可以设置的 Input 的 step 属性:

use Filament\Forms\Components\TextInput;

TextInput::make('number')
->numeric()
->step(100)
除了允许静态值之外,step() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

自动补全文本​

使用 autocomplete() 方法,你可以启用浏览器的自动补全功能:

use Filament\Forms\Components\TextInput;

TextInput::make('password')
->password()
->autocomplete('new-password')

你也可以使用 autocomplete(false),作为 autocomplete="off" 的快捷方式:

use Filament\Forms\Components\TextInput;

TextInput::make('password')
->password()
->autocomplete(false)
除了允许静态值之外,autocomplete() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

对于更复杂的自动补全选项,文本输入框也支持 datalists。

使用 datalist 自动补全​

使用 datalist() 方法,你可以指定文本输入框的 datalist 选项:

TextInput::make('manufacturer')
->datalist([
'BMW',
'Ford',
'Mercedes-Benz',
'Porsche',
'Toyota',
'Volkswagen',
])

使用文本输入框时,Datalist 为用户提供自动补全选项。不过,这些选项纯属推荐,用户仍然在输入框中可以输入任何值。如果你想要限制用户输入一组预定义选项,请查阅 Select 字段。

除了允许静态值之外,datalist() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

自动大写文本​

使用 autocapitalize() 方法,你可以允许浏览器自动大写文本内容:

use Filament\Forms\Components\TextInput;

TextInput::make('name')
->autocapitalize('words')
除了允许静态值之外,autocapitalize() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

字段旁边添加前后缀文本​

使用 prefix() 及 suffix() 方法,你可以在输入框前后添加文本:

use Filament\Forms\Components\TextInput;

TextInput::make('domain')
->prefix('https://')
->suffix('.com')
除了允许静态值之外,prefix() 和 suffix() 方法也接受一个函数来动态计算它们的值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.
Text input with affixes

使用图标作为前后缀​

使用 prefixIcon() 和 suffixIcon() 方法,你可以在输入框前面或者后面放置图标:

use Filament\Forms\Components\TextInput;
use Filament\Support\Icons\Heroicon;

TextInput::make('domain')
->url()
->suffixIcon(Heroicon::GlobeAlt)
除了允许静态值之外,prefixIcon() 和 suffixIcon() 方法也接受一个函数来动态计算它们的值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.
Text input with suffix icon

设置前后缀图标颜色​

前后缀图标默认是灰色,不过你可以使用 prefixIconColor() 和 suffixIconColor() 方法将其设为不同颜色:

use Filament\Forms\Components\TextInput;
use Filament\Support\Icons\Heroicon;

TextInput::make('domain')
->url()
->suffixIcon(Heroicon::CheckCircle)
->suffixIconColor('success')
除了允许静态值之外,prefixIconColor() 和 suffixIconColor() 方法也接受一个函数来动态计算它们的值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.
Text input with suffix icon in color

将 Action 用作前后缀​

吧可以使用 prefixAction() 和 suffixAction() 方法,在输入内容的前后放置操作:

use Filament\Actions\Action;
use Filament\Forms\Components\TextInput;
use Filament\Support\Icons\Heroicon;

TextInput::make('cost')
->prefix('€')
->suffixAction(
Action::make('copyCostToPrice')
->icon(Heroicon::Clipboard),
)
Text input with suffix action

可显示的密码输入​

使用 password() 时,你也可以使之可见 revealable(),这样用户可以通过点击按钮查看他们正在输入的密码的明文:

use Filament\Forms\Components\TextInput;

TextInput::make('password')
->password()
->revealable()
Text input with revealable password

此外,你也可以传入一个布尔值,控制输入框是否可显示密码:

use Filament\Forms\Components\TextInput;

TextInput::make('password')
->password()
->revealable(FeatureFlag::active())
除了允许静态值之外,revealable() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

允许将文本复制到剪贴板​

你可以设置文本为可复制状态,使得点击输入框旁的按钮即可将文本复制到剪贴板;此外,你也可以选择指定自定义的确认提示信息及其显示时长(以毫秒为单位):

use Filament\Forms\Components\TextInput;

TextInput::make('apiKey')
->label('API key')
->copyable(copyMessage: 'Copied!', copyMessageDuration: 1500)
Text input with copyable button

或者,你也可以传入一个布尔值,以控制文本是否可复制:

use Filament\Forms\Components\TextInput;

TextInput::make('apiKey')
->label('API key')
->copyable(FeatureFlag::active())
除了静态值之外,copyable() 方法也接受函数作为参数动态计算其值。你可以将各种 utility 作为参数注入该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

NOTE

该功能只有在应用启用 SSL 后才生效。

输入掩码​

输入掩码(Input Masking)定义了一种输入值必须遵守的格式。

在 Filament 中,你可以使用 mask() 方法来配置 Alpine.js 的 mask:

use Filament\Forms\Components\TextInput;

TextInput::make('birthday')
->mask('99/99/9999')
->placeholder('MM/DD/YYYY')
Text input with mask

要使用动态掩码,请在 RawJs 对象中包裹 JavaScript:

use Filament\Forms\Components\TextInput;
use Filament\Support\RawJs;

TextInput::make('cardNumber')
->mask(RawJs::make(<<<'JS'
$input.startsWith('34') || $input.startsWith('37') ? '9999 999999 99999' : '9999 9999 9999 9999'
JS))
除了允许静态值之外,mask() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

Alpine.js 将整个掩码值发送给服务器,因此在验证字段并保存它之前,你可能需要从状态中删除某些字符。你可以使用 stripCharacters() 方法来执行此操作,传入一个字符或一个字符数组以将其从掩码值中删除:

use Filament\Forms\Components\TextInput;
use Filament\Support\RawJs;

TextInput::make('amount')
->mask(RawJs::make('$money($input)'))
->stripCharacters(',')
->numeric()
除了允许静态值之外,stripCharacters() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

去除空白字符​

你可以使用 trim() 方法自动去除输入值首尾的空白字符:

use Filament\Forms\Components\TextInput;

TextInput::make('name')
->trim()

你可能希望为所有文本输入全局启用去除首尾空格的功能,这类似于 Laravel 的 TrimStrings 中间件。你可以通过服务提供者中的 configureUsing() 方法来实现这一点:

use Filament\Forms\Components\TextInput;

TextInput::configureUsing(function (TextInput $component): void {
$component->trim();
});

使字段只读​

不要与禁用字段混为一谈,使用 readOnly() 方法,你可以让该字段变为只读:

use Filament\Forms\Components\TextInput;

TextInput::make('name')
->readOnly()

相比于 disabled(),它有一些不同之处:

  • 使用 readOnly() 时,该字段仍然会在表单提交时发送给服务器。使用浏览器控制台或者通过 JavaScript,仍然可以修改它的值。可以使用 saved(false) 阻止该行为。
  • 使用 readOnly() 时,样式不会改变,比如不会减少透明度。
  • 使用 readOnly() 时,该字段仍然可以获得焦点。

此外,你也可以传入一个布尔值,控制字段是否只读:

use Filament\Forms\Components\TextInput;

TextInput::make('name')
->readOnly(FeatureFlag::active())
除了允许静态值之外,readOnly() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

文本输入验证​

除了验证页面中列出的规则之外,还有一些特别针对文本输入框的另外的规则。

长度验证​

通过设置 minLength() 和 maxLength() 方法,你可以限制输入的长度。这些方法同时会对前端和后端进行验证:

use Filament\Forms\Components\TextInput;

TextInput::make('name')
->minLength(2)
->maxLength(255)

通过设置 length(),你可以指定输入框的准确长度。该方法同时添加前端和后端验证:

use Filament\Forms\Components\TextInput;

TextInput::make('code')
->length(8)
除了允许静态值之外,minLength()、maxLength() 和 length() 方法也接受一个函数来动态计算它们的值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

Size 验证​

通过设置 minValue() 和 maxValue() 方法,你可以验证数值输入框的最小和最大值:

use Filament\Forms\Components\TextInput;

TextInput::make('number')
->numeric()
->minValue(1)
->maxValue(100)
除了允许静态值之外,minValue() 和 maxValue() 方法也接受一个函数来动态计算它们的值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.

电话号码验证​

使用 tel() 字段时,字段值会使用 /^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/ 验证。

如果你想对此进行修改,你可以使用 telRegex() 方法:

use Filament\Forms\Components\TextInput;

TextInput::make('phone')
->tel()
->telRegex('/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/')

此外,要全局自定义 telRegex,请使用服务提供者:

use Filament\Forms\Components\TextInput;

TextInput::configureUsing(function (TextInput $component): void {
$component->telRegex('/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/');
});
除了允许静态值之外,telRegex() 方法也接受一个函数来动态计算其值。你可以将各种 utility 作为参数注入到该函数中。Learn more about utility injection.
UtilityTypeParameterDescription
FieldFilament\Forms\Components\Field$componentThe current field component instance.
Get functionFilament\Schemas\Components\Utilities\Get$getA function for retrieving values from the current form data. Validation is not run.
LivewireLivewire\Component$livewireThe Livewire component instance.
Eloquent model FQN?string<Illuminate\Database\Eloquent\Model>$modelThe Eloquent model FQN for the current schema.
Operationstring$operationThe current operation being performed by the schema. Usually <code>create</code>, <code>edit</code>, or <code>view</code>.
Raw statemixed$rawStateThe current value of the field, before state casts were applied. Validation is not run.
Eloquent record?Illuminate\Database\Eloquent\Model$recordThe Eloquent record for the current schema.
Statemixed$stateThe current value of the field. Validation is not run.