@@ -32,69 +32,73 @@ public function tableGet_($tableName)
3232 return TableController::tableGet ($ tableName );
3333 }
3434
35- public function rowGet_ ($ tableName ,$ id )
36- {
37- return RowController::rowGet ($ tableName ,$ id );
38- }
39-
4035 public function tableRemove_ ($ tableName )
4136 {
4237 TableController::tableRemove ($ tableName );
4338
4439 return TableController::tableGet (false );
4540 }
4641
47- public function rowRemove_ ($ tableName ,$ id )
48- {
49- RowController::rowRemove ($ tableName ,$ id );
50-
51- return TableController::tableGet ($ tableName );
52- }
53-
5442 public function tableStore_ ()
5543 {
5644 return TableController::tableStore ();
5745 }
5846
59- public function rowStore_ ($ tableName )
60- {
61- if (!TableController::tableExists ($ tableName ))
62- return abort (404 , "Table ' $ tableName' don´t exist. " );
63-
64- return RowController::rowStore ($ tableName );
65- }
66-
6747 public function tableUpdate_ ($ tableName , Request $ request )
6848 {
6949 if (!$ request ->has ('columns ' ))
7050 return abort (400 , "No columns given. " );
7151
72- $ tableinfoNew = [ 'tablename ' => $ request ->input ('tablename ' ), 'originalTablename ' => $ tableName ];
73-
74- $ tableinfoNew ['columns ' ][] = array ('originalName ' => 'id ' , 'originalType ' => "increments " );
52+ $ tableinfoNew = [
53+ 'tablename ' => $ request ->input ('tablename ' ),
54+ 'originalTablename ' => $ tableName ,
55+ 'columns ' => [
56+ 0 => [ 'originalName ' => 'id ' , 'originalType ' => 'increments ' ]
57+ ]
58+ ];
7559
7660 foreach ($ request ->input ('columns ' ) as $ columnNew ){
7761
78- if ($ columnNew ['originalName ' ] != "id " ) // Don´t use these
79- if (strtoupper ($ columnNew ['originalType ' ])=="TEXT " || strtoupper ($ columnNew ['originalType ' ])=="INTEGER " ) // Enabled types
62+ if ($ columnNew ['originalName ' ] != "id " )
63+ if (strtoupper ($ columnNew ['originalType ' ])=="TEXT " || strtoupper ($ columnNew ['originalType ' ])=="INTEGER " )
8064 $ tableinfoNew ['columns ' ][] = $ columnNew ;
8165
8266 }
8367
8468 return TableController::tableUpdate ($ tableName ,$ tableinfoNew );
8569 }
8670
71+
72+ public function rowGet_ ($ tableName ,$ id )
73+ {
74+ return RowController::rowGet ($ tableName ,$ id );
75+ }
76+
77+ public function rowRemove_ ($ tableName ,$ id )
78+ {
79+ RowController::rowRemove ($ tableName ,$ id );
80+
81+ return TableController::tableGet ($ tableName );
82+ }
83+
84+ public function rowStore_ ($ tableName )
85+ {
86+ if (!TableController::tableExists ($ tableName ))
87+ return abort (404 , "Table ' $ tableName' don´t exist. " );
88+
89+ return RowController::rowStore ($ tableName );
90+ }
91+
8792 public function rowUpdate_ ($ tableName , $ id , Request $ request )
8893 {
8994 if (!TableController::tableExists ($ tableName ))
9095 return abort (404 , "Table ' $ tableName' don´t exist. " );
9196
92- $ row = array ();
93- $ row ['id ' ] = $ id ;
97+ $ row = [ 'id ' => $ id ];
9498
9599 foreach ($ request ->input () as $ column => $ value ) {
96100
97- if ($ column != "id " ) // Don´t use these
101+ if ($ column != "id " )
98102 $ row [$ column ] = $ value ;
99103
100104 }
0 commit comments