@@ -55,7 +55,7 @@ public function __construct(Rule $eloquent)
5555 */
5656 public function savePolicyLine (string $ ptype , array $ rule ): void
5757 {
58- $ col ['p_type ' ] = $ ptype ;
58+ $ col ['ptype ' ] = $ ptype ;
5959 foreach ($ rule as $ key => $ value ) {
6060 $ col ['v ' .strval ($ key )] = $ value ;
6161 }
@@ -127,7 +127,7 @@ public function addPolicies(string $sec, string $ptype, array $rules): void
127127 $ i = 0 ;
128128
129129 foreach ($ rules as $ rule ) {
130- $ temp ['p_type ' ] = $ ptype ;
130+ $ temp ['ptype ' ] = $ ptype ;
131131 $ temp ['created_at ' ] = new DateTime ();
132132 $ temp ['updated_at ' ] = $ temp ['created_at ' ];
133133 foreach ($ rule as $ key => $ value ) {
@@ -149,7 +149,7 @@ public function addPolicies(string $sec, string $ptype, array $rules): void
149149 */
150150 public function removePolicy (string $ sec , string $ ptype , array $ rule ): void
151151 {
152- $ instance = $ this ->eloquent ->where ('p_type ' , $ ptype );
152+ $ instance = $ this ->eloquent ->where ('ptype ' , $ ptype );
153153
154154 foreach ($ rule as $ key => $ value ) {
155155 $ instance ->where ('v ' .strval ($ key ), $ value );
@@ -187,7 +187,7 @@ public function removePolicies(string $sec, string $ptype, array $rules): void
187187 */
188188 public function removeFilteredPolicy (string $ sec , string $ ptype , int $ fieldIndex , string ...$ fieldValues ): void
189189 {
190- $ instance = $ this ->eloquent ->where ('p_type ' , $ ptype );
190+ $ instance = $ this ->eloquent ->where ('ptype ' , $ ptype );
191191
192192 foreach (range (0 , 5 ) as $ value ) {
193193 if ($ fieldIndex <= $ value && $ value < $ fieldIndex + count ($ fieldValues )) {
@@ -212,7 +212,7 @@ public function removeFilteredPolicy(string $sec, string $ptype, int $fieldIndex
212212 */
213213 public function updatePolicy (string $ sec , string $ ptype , array $ oldRule , array $ newPolicy ): void
214214 {
215- $ instance = $ this ->eloquent ->where ('p_type ' , $ ptype );
215+ $ instance = $ this ->eloquent ->where ('ptype ' , $ ptype );
216216 foreach ($ oldRule as $ k => $ v ) {
217217 $ instance ->where ('v ' . $ k , $ v );
218218 }
@@ -255,7 +255,7 @@ public function updatePolicies(string $sec, string $ptype, array $oldRules, arra
255255 */
256256 public function updateFilteredPolicies (string $ sec , string $ ptype , array $ newPolicies , int $ fieldIndex , string ...$ fieldValues ): array
257257 {
258- $ where ['p_type ' ] = $ ptype ;
258+ $ where ['ptype ' ] = $ ptype ;
259259 foreach ($ fieldValues as $ fieldValue ) {
260260 if (!is_null ($ fieldValue ) && $ fieldValue !== '' ) {
261261 $ where ['v ' . $ fieldIndex ++] = $ fieldValue ;
@@ -265,7 +265,7 @@ public function updateFilteredPolicies(string $sec, string $ptype, array $newPol
265265 $ newP = [];
266266 $ oldP = [];
267267 foreach ($ newPolicies as $ newRule ) {
268- $ col ['p_type ' ] = $ ptype ;
268+ $ col ['ptype ' ] = $ ptype ;
269269 $ col ['created_at ' ] = new DateTime ();
270270 $ col ['updated_at ' ] = $ col ['created_at ' ];
271271 foreach ($ newRule as $ key => $ value ) {
@@ -282,7 +282,7 @@ public function updateFilteredPolicies(string $sec, string $ptype, array $newPol
282282 $ item = array_filter ($ item , function ($ value ) {
283283 return !is_null ($ value ) && $ value !== '' ;
284284 });
285- unset($ item ['p_type ' ]);
285+ unset($ item ['ptype ' ]);
286286 }
287287
288288 $ oldRules ->delete ();
0 commit comments