mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Check that the array key exists before trying to seed it
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
d187174f00
commit
fa439a1928
|
@ -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