File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/app/Library/CrudPanel Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -78,10 +78,18 @@ public function key(string $key)
7878 if (! isset ($ this ->attributes ['name ' ])) {
7979 abort (500 , 'Column name must be defined before changing the key. ' );
8080 }
81- if ($ this ->crud ()->hasColumnWhere ('key ' , $ this ->attributes ['key ' ])) {
82- $ this ->crud ()->setColumnDetails ($ this ->attributes ['key ' ], array_merge ($ this ->attributes , ['key ' => $ key ]));
81+
82+ $ columns = $ this ->crud ()->columns ();
83+ $ searchKey = $ this ->attributes ['key ' ];
84+ $ column = $ this ->attributes ;
85+
86+ if (isset ($ columns [$ searchKey ])) {
87+ unset($ columns [$ searchKey ]);
88+ $ column ['key ' ] = $ key ;
8389 }
84- $ this ->attributes ['key ' ] = $ key ;
90+
91+ $ this ->attributes = $ column ;
92+ $ this ->setOperationSetting ('columns ' , array_merge ($ columns , [$ key => $ column ]));
8593
8694 return $ this ;
8795 }
You can’t perform that action at this time.
0 commit comments