Skip to content
This repository was archived by the owner on Mar 2, 2023. It is now read-only.

Commit ead959a

Browse files
committed
master - added not for encrypted columns where
1 parent 7a06a77 commit ead959a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/Models/BaseModel.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,20 @@ public function scopeWhereEncrypted($query, $column, $value)
218218
return $query->whereRaw('AES_DECRYPT(' . $column . ', "' . getenv("ENCRYPTION_KEY") . '") LIKE "' . $value . '" COLLATE utf8mb4_general_ci');
219219
}
220220

221+
/**
222+
* where not for encrypted columns
223+
*
224+
* @param $query
225+
* @param $column
226+
* @param $value
227+
*
228+
* @return mixed
229+
*/
230+
public function scopeWhereNotEncrypted($query, $column, $value)
231+
{
232+
return $query->whereRaw('AES_DECRYPT(' . $column . ', "' . getenv("ENCRYPTION_KEY") . '") NOT LIKE "' . $value . '" COLLATE utf8mb4_general_ci');
233+
}
234+
221235
/**
222236
* orWhere for encrypted columns
223237
*
@@ -232,6 +246,20 @@ public function scopeOrWhereEncrypted($query, $column, $value)
232246
return $query->orWhereRaw('AES_DECRYPT(' . $column . ', "' . getenv("ENCRYPTION_KEY") . '") LIKE "' . $value . '" COLLATE utf8mb4_general_ci');
233247
}
234248

249+
/**
250+
* orWhere not for encrypted columns
251+
*
252+
* @param $query
253+
* @param $column
254+
* @param $value
255+
*
256+
* @return mixed
257+
*/
258+
public function scopeOrWhereNotEncrypted($query, $column, $value)
259+
{
260+
return $query->orWhereRaw('AES_DECRYPT(' . $column . ', "' . getenv("ENCRYPTION_KEY") . '") NOT LIKE "' . $value . '" COLLATE utf8mb4_general_ci');
261+
}
262+
235263
/**
236264
* orderBy for encrypted columns
237265
*

0 commit comments

Comments
 (0)