Mar 5, 2024
0
Level 1
Livewire validation unique rule and custom message
Good morning everyone,
I need your help with a problem when trying to change the unique message I need to return in the message what data is related to a duplicate entry, for example, the message "The project name is already in use (".$project->project_name."|".$project->branch."|".$project->done_by."|".Carbon::parse()->format('m/d/Y').')';
I'm not sure how can I do it, somebody could help me? My rules
public function rules():array
{
return [
'daily.status_id' => ['required'],
'daily.done_by' => ['required','max:3'],
'daily.branch' => ['required'],
'daily.project_name' => ['required',
Rule::unique('dailies','project_name')->ignore($this->daily)
],
'daily.slug' => ['required','alpha_dash',
Rule::unique('dailies','slug')->ignore($this->daily)
],
'daily.completed_by' => ['date','nullable'],
'daily.takeoff_time' => ['nullable','numeric'],
'daily.revision' => ['nullable','string'],
'daily.notes' => ['nullable']
];
}
Please or to participate in this conversation.