mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
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:
commit
baf14c43ee
|
@ -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'])
|
||||||
|
|
Loading…
Reference in a new issue