Ensure at the model level that location.id/user.id and location.parent_id/user.manager_id cannot be the same

This commit is contained in:
snipe
2020-04-21 19:51:20 -07:00
parent 5dc64ea91b
commit c02adace61
2 changed files with 9 additions and 7 deletions
+8 -7
View File
@@ -20,13 +20,14 @@ class Location extends SnipeModel
protected $dates = ['deleted_at'];
protected $table = 'locations';
protected $rules = array(
'name' => 'required|min:2|max:255|unique_undeleted',
'city' => 'min:2|max:255|nullable',
'country' => 'min:2|max:2|nullable',
'address' => 'max:80|nullable',
'address2' => 'max:80|nullable',
'zip' => 'min:3|max:10|nullable',
'manager_id' => 'exists:users,id|nullable'
'name' => 'required|min:2|max:255|unique_undeleted',
'city' => 'min:2|max:255|nullable',
'country' => 'min:2|max:2|nullable',
'address' => 'max:80|nullable',
'address2' => 'max:80|nullable',
'zip' => 'min:3|max:10|nullable',
'manager_id' => 'exists:users,id|nullable',
'parent_id' => 'nullable|different:id',
);
/**