DataTables Editor requires three (3) rules for create, edit and remove action respectively.
This are the rules that will be used when validating a create action.
public function createRules() {
return [
'email' => 'required|email|unique:users',
'name' => 'required',
];
}
This are the rules that will be used when validating an edit action.
public function editRules(Model $model) {
return [
'email' => 'sometimes|required|email|' . Rule::unique($model->getTable())->ignore($model->getKey()),
'first_name' => 'sometimes|required',
];
}
This are the rules that will be used when validating a remove action.
public function removeRules(Model $model) {
return [];
}
This are the rules that will be used when validating an upload action.
public function uploadRules() {
return [
'avatar' => 'required|image',
'resume' => 'required|mimes:pdf',
];
}