Skip to content

Commit b780670

Browse files
committed
fix lookup component and add Convert empty stringto null middleware.
1 parent b07b3bd commit b780670

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

app/Http/Kernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Kernel extends HttpKernel
2121
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
2222
\App\Http\Middleware\TrimStrings::class,
2323
\Webkul\Installer\Http\Middleware\CanInstall::class,
24+
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
2425
];
2526

2627
/**

packages/Webkul/Admin/src/Resources/views/components/attributes/edit/lookup.blade.php

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,16 @@ class="px-4 py-2 text-center text-gray-500"
131131
};
132132
},
133133
134+
mounted() {
135+
if (this.value) {
136+
this.selectedItem = this.value;
137+
}
138+
},
134139
135140
watch: {
136-
value(newValue, oldValue) {
137-
if (
138-
JSON.stringify(newValue)
139-
!== JSON.stringify(oldValue)
140-
) {
141-
this.searchTerm = newValue ? newValue['name'] : '';
142-
143-
this.entityId = newValue ? newValue['id'] : '';
144-
145-
if (this.searchTerm == '') {
146-
this.remove();
147-
} else {
148-
this.getLookUpEntity();
149-
}
150-
}
151-
}
141+
searchTerm(newVal, oldVal) {
142+
this.search();
143+
},
152144
},
153145
154146
mounted() {
@@ -235,8 +227,8 @@ class="px-4 py-2 text-center text-gray-500"
235227
this.searchedResults = [];
236228
237229
this.$emit('lookup-removed');
238-
}
239-
}
230+
},
231+
},
240232
});
241233
</script>
242234
@endPushOnce

packages/Webkul/Admin/src/Resources/views/components/lookup/index.blade.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ class="cursor-pointer border-t border-gray-800 px-4 py-2 text-gray-500 hover:bg-
177177
if (this.value) {
178178
this.selectedItem = this.value;
179179
}
180-
181-
console.log(this.selectedItem?.name == "");
182180
},
183181
184182
created() {

0 commit comments

Comments
 (0)