@@ -55,7 +55,7 @@ public function __construct(Rule $eloquent)
55
55
*/
56
56
public function savePolicyLine (string $ ptype , array $ rule ): void
57
57
{
58
- $ col ['p_type ' ] = $ ptype ;
58
+ $ col ['ptype ' ] = $ ptype ;
59
59
foreach ($ rule as $ key => $ value ) {
60
60
$ col ['v ' .strval ($ key )] = $ value ;
61
61
}
@@ -127,7 +127,7 @@ public function addPolicies(string $sec, string $ptype, array $rules): void
127
127
$ i = 0 ;
128
128
129
129
foreach ($ rules as $ rule ) {
130
- $ temp ['p_type ' ] = $ ptype ;
130
+ $ temp ['ptype ' ] = $ ptype ;
131
131
$ temp ['created_at ' ] = new DateTime ();
132
132
$ temp ['updated_at ' ] = $ temp ['created_at ' ];
133
133
foreach ($ rule as $ key => $ value ) {
@@ -149,7 +149,7 @@ public function addPolicies(string $sec, string $ptype, array $rules): void
149
149
*/
150
150
public function removePolicy (string $ sec , string $ ptype , array $ rule ): void
151
151
{
152
- $ instance = $ this ->eloquent ->where ('p_type ' , $ ptype );
152
+ $ instance = $ this ->eloquent ->where ('ptype ' , $ ptype );
153
153
154
154
foreach ($ rule as $ key => $ value ) {
155
155
$ instance ->where ('v ' .strval ($ key ), $ value );
@@ -187,7 +187,7 @@ public function removePolicies(string $sec, string $ptype, array $rules): void
187
187
*/
188
188
public function removeFilteredPolicy (string $ sec , string $ ptype , int $ fieldIndex , string ...$ fieldValues ): void
189
189
{
190
- $ instance = $ this ->eloquent ->where ('p_type ' , $ ptype );
190
+ $ instance = $ this ->eloquent ->where ('ptype ' , $ ptype );
191
191
192
192
foreach (range (0 , 5 ) as $ value ) {
193
193
if ($ fieldIndex <= $ value && $ value < $ fieldIndex + count ($ fieldValues )) {
@@ -212,7 +212,7 @@ public function removeFilteredPolicy(string $sec, string $ptype, int $fieldIndex
212
212
*/
213
213
public function updatePolicy (string $ sec , string $ ptype , array $ oldRule , array $ newPolicy ): void
214
214
{
215
- $ instance = $ this ->eloquent ->where ('p_type ' , $ ptype );
215
+ $ instance = $ this ->eloquent ->where ('ptype ' , $ ptype );
216
216
foreach ($ oldRule as $ k => $ v ) {
217
217
$ instance ->where ('v ' . $ k , $ v );
218
218
}
@@ -255,7 +255,7 @@ public function updatePolicies(string $sec, string $ptype, array $oldRules, arra
255
255
*/
256
256
public function updateFilteredPolicies (string $ sec , string $ ptype , array $ newPolicies , int $ fieldIndex , string ...$ fieldValues ): array
257
257
{
258
- $ where ['p_type ' ] = $ ptype ;
258
+ $ where ['ptype ' ] = $ ptype ;
259
259
foreach ($ fieldValues as $ fieldValue ) {
260
260
if (!is_null ($ fieldValue ) && $ fieldValue !== '' ) {
261
261
$ where ['v ' . $ fieldIndex ++] = $ fieldValue ;
@@ -265,7 +265,7 @@ public function updateFilteredPolicies(string $sec, string $ptype, array $newPol
265
265
$ newP = [];
266
266
$ oldP = [];
267
267
foreach ($ newPolicies as $ newRule ) {
268
- $ col ['p_type ' ] = $ ptype ;
268
+ $ col ['ptype ' ] = $ ptype ;
269
269
$ col ['created_at ' ] = new DateTime ();
270
270
$ col ['updated_at ' ] = $ col ['created_at ' ];
271
271
foreach ($ newRule as $ key => $ value ) {
@@ -282,7 +282,7 @@ public function updateFilteredPolicies(string $sec, string $ptype, array $newPol
282
282
$ item = array_filter ($ item , function ($ value ) {
283
283
return !is_null ($ value ) && $ value !== '' ;
284
284
});
285
- unset($ item ['p_type ' ]);
285
+ unset($ item ['ptype ' ]);
286
286
}
287
287
288
288
$ oldRules ->delete ();
0 commit comments