Merge pull request #12298 from snipe/fixes/db_seeder_company_id

Fixed db seeder when company id is not present
This commit is contained in:
snipe 2023-01-03 14:50:25 -08:00 committed by GitHub
commit baf14c43ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -218,7 +218,7 @@ class ValidationServiceProvider extends ServiceProvider
Validator::extend('is_unique_department', function ($attribute, $value, $parameters, $validator) { Validator::extend('is_unique_department', function ($attribute, $value, $parameters, $validator) {
$data = $validator->getData(); $data = $validator->getData();
if ($data['location_id'] != null && $data['company_id'] != null) { if ((array_key_exists('location_id', $data) && $data['location_id'] != null) && (array_key_exists('company_id', $data) && $data['company_id'] != null)) {
$count = Department::where('name', $data['name']) $count = Department::where('name', $data['name'])
->where('location_id', $data['location_id']) ->where('location_id', $data['location_id'])
->where('company_id', $data['company_id']) ->where('company_id', $data['company_id'])