From e3f48c7bb854c1b453977eacc76103af3176100d Mon Sep 17 00:00:00 2001 From: pascalbaljet Date: Fri, 2 Apr 2021 11:45:13 +0200 Subject: [PATCH 1/2] Update Table.vue --- js/Components/Table.vue | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/js/Components/Table.vue b/js/Components/Table.vue index 18695e0..abba8ff 100644 --- a/js/Components/Table.vue +++ b/js/Components/Table.vue @@ -3,31 +3,39 @@ export default { props: { meta: { type: Object, - default: () => {}, + default: () => { + return {}; + }, required: false, }, columns: { type: Object, - default: () => {}, + default: () => { + return {}; + }, required: false, }, filters: { type: Object, - default: () => {}, + default: () => { + return {}; + }, required: false, }, search: { type: Object, - default: () => {}, + default: () => { + return {}; + }, required: false, }, onUpdate: { type: Function, - required: true, + required: false, }, }, @@ -96,7 +104,9 @@ export default { queryBuilderData: { deep: true, handler() { - this.onUpdate(this.queryBuilderData); + if (this.onUpdate) { + this.onUpdate(this.queryBuilderData); + } }, }, }, From 30448266cee428919d3f595bb9f594edf3a1ee3e Mon Sep 17 00:00:00 2001 From: pascalbaljet Date: Fri, 2 Apr 2021 11:48:38 +0200 Subject: [PATCH 2/2] Update InertiaTableServiceProvider.php --- php/InertiaTableServiceProvider.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/php/InertiaTableServiceProvider.php b/php/InertiaTableServiceProvider.php index 801d3d6..c8cd777 100644 --- a/php/InertiaTableServiceProvider.php +++ b/php/InertiaTableServiceProvider.php @@ -10,17 +10,13 @@ class InertiaTableServiceProvider extends ServiceProvider public function boot() { Response::macro('table', function (callable $withTableBuilder = null) { - $request = request(); - - $response = $this; + $tableBuilder = new InertiaTable(request()); if ($withTableBuilder) { - $tableBuilder = new InertiaTable($request); $withTableBuilder($tableBuilder); - $tableBuilder->applyTo($response); } - return $response; + return $tableBuilder->applyTo($this); }); } }