@@ -95,18 +95,18 @@ public function create()
9595
9696 // get all attributes
9797 $ values = [];
98- $ attributes = DB ::table ('attributes ' )
99- ->select ('values ' )
100- ->get ();
101- foreach ($ attributes as $ attribute ) {
102- foreach (explode (' ' , $ attribute ->values ) as $ value ) {
103- if (strlen ($ value ) > 0 ) {
104- array_push ($ values , $ value );
105- }
98+ $ attributes = DB ::table ('attributes ' )->select ('values ' )
99+ ->union (DB ::table ('measures ' )
100+ ->select (DB ::raw ('attributes as value ' )))
101+ ->get ();
102+ foreach ($ attributes as $ key ) {
103+ foreach (explode (' ' , $ key ->values ) as $ value ) {
104+ array_push ($ values , $ value );
106105 }
107- sort ($ values );
108- $ values = array_unique ($ values );
109106 }
107+ sort ($ values );
108+ $ values = array_unique ($ values );
109+
110110 // for clone action
111111 $ measure = null ;
112112
@@ -235,14 +235,13 @@ public function edit(int $id)
235235
236236 // get all attributes
237237 $ values = [];
238- $ attributes = DB ::table ('attributes ' )
239- ->select ('values ' )
240- ->get ();
241- foreach ($ attributes as $ attribute ) {
242- foreach (explode (' ' , $ attribute ->values ) as $ value ) {
243- if (strlen ($ value ) > 0 ) {
244- array_push ($ values , $ value );
245- }
238+ $ attributes = DB ::table ('attributes ' )->select ('values ' )
239+ ->union (DB ::table ('measures ' )
240+ ->select (DB ::raw ('attributes as value ' )))
241+ ->get ();
242+ foreach ($ attributes as $ key ) {
243+ foreach (explode (' ' , $ key ->values ) as $ value ) {
244+ array_push ($ values , $ value );
246245 }
247246 }
248247 sort ($ values );
@@ -533,7 +532,7 @@ public function activate(Request $request)
533532 $ control = new Control ();
534533 $ control ->name = $ request ->get ('name ' );
535534 $ control ->scope = $ request ->get ('scope ' );
536- $ control ->attributes = $ request-> get ('attributes[] ' ) ;
535+ $ control ->attributes = request ('attributes ' ) !== null ? implode ( ' ' , request ( ' attributes ' )) : null ;
537536 $ control ->objective = $ request ->get ('objective ' );
538537 $ control ->input = $ request ->get ('input ' );
539538 $ control ->model = $ request ->get ('model ' );
0 commit comments