This is from validation that I have used for tag form validation
public function rules()
{
return [
'name' => 'required|max:50|min:3|unique:tags,name,'.$this->tag,
];
}
My controller code
public function update(TagValidation $request, Tag $tag )
{
$tag->update($request->all());
}
I am trying to avoid unique filed validation problem when trying to update. After use
unique:tags,name,'.$this->tag
I am getting below sql error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name:"abc"' in 'where clause' (SQL: select count(*) as aggregate from `tags` where `name` = abc and `name:"abc"` <> {"id":14 and `created_at:"2020-06-13T16:24:36`.`000000Z"` = updated_at:"2020-06-13T16:46:44.000000Z"})
But I have name column in database and store is working fine If I not use $this->tag in validation.