Yii Framework Forum: Change field name - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Change field name

#1 User is offline   faizanktk 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 22-September 17

Posted 15 November 2017 - 09:19 AM

[['name'], 'unique', 'message' => 'This Make already exists'],
output

[
{
"field": "name",
"message": "This Make already exists"
}
]
how i change field?

Expected Result

[
{
"field": "make",
"message": "This Make already exists"
}
]
0

#2 User is offline   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,497
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 15 November 2017 - 10:48 AM

provided you have a field with that name in the database, you can change the field name in the rules like so

[['make'], 'unique', 'message' => 'This Make already exists'],

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users