Skip to content
Icon

WARNING You're browsing the documentation for an old version of LARAVEL-DATATABLES. Consider upgrading your project to laravel-datatables 11.0.

DataTables Editor Rules

DataTables Editor requires three (3) rules for create, edit and remove action respectively.

Create Rules

This are the rules that will be used when validating a create action.

public function createRules() {
return [
'email' => 'required|email|unique:users',
'name' => 'required',
];
}

Edit Rules

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',
];
}

Remove Rules

This are the rules that will be used when validating a remove action.

public function removeRules(Model $model) {
return [];
}