How could you configure the filament select component so that I get the first and last name?
您如何配置灯丝选择组件,以便我获得名字和姓氏?
public static function form(Form $form): Form
{
return $form
->schema([
Select::make('customer_id')
->relationship('customer', 'name')
->searchable(['name', 'surname'])
->preload()
->required()
->createOptionForm([
TextInput::make('name')
->required()
->label('Nombre'),
TextInput::make('surname')
->required(),
TextInput::make('lastname')
->label('Last Name')
]),
]);
}
I tried with an array but it doesn't work
我尝试使用数组,但不起作用
->relationship('customer', ['name', 'lastname'])
->关系(‘Customer’,[‘name’,‘Lastname’])
更多回答
->relationship('customer', \DB::raw("CONCAT(name, ' ', lastname) as full_name"))
->Relationship(‘Customer’,\DB::RAW(“Concat(name,‘’,lastname)as Full_Name”))
优秀答案推荐
我是一名优秀的程序员,十分优秀!