Remove Postgres specific database features

This commit is contained in:
Jonathan Reinink 2019-04-02 13:05:17 -04:00
parent b62838e81f
commit 710326e479
3 changed files with 8 additions and 8 deletions

View File

@ -27,11 +27,11 @@ class Contact extends Model
{
$query->when($filters['search'] ?? null, function ($query, $search) {
$query->where(function ($query) use ($search) {
$query->where('first_name', 'ilike', '%'.$search.'%')
->orWhere('last_name', 'ilike', '%'.$search.'%')
->orWhere('email', 'ilike', '%'.$search.'%')
$query->where('first_name', 'like', '%'.$search.'%')
->orWhere('last_name', 'like', '%'.$search.'%')
->orWhere('email', 'like', '%'.$search.'%')
->orWhereHas('organization', function ($query) use ($search) {
$query->where('name', 'ilike', '%'.$search.'%');
$query->where('name', 'like', '%'.$search.'%');
});
});
})->when($filters['trashed'] ?? null, function ($query, $trashed) {

View File

@ -16,7 +16,7 @@ class Organization extends Model
public function scopeFilter($query, array $filters)
{
$query->when($filters['search'] ?? null, function ($query, $search) {
$query->where('name', 'ilike', '%'.$search.'%');
$query->where('name', 'like', '%'.$search.'%');
})->when($filters['trashed'] ?? null, function ($query, $trashed) {
if ($trashed === 'with') {
$query->withTrashed();

View File

@ -45,9 +45,9 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
{
$query->when($filters['search'] ?? null, function ($query, $search) {
$query->where(function ($query) use ($search) {
$query->where('first_name', 'ilike', '%'.$search.'%')
->orWhere('last_name', 'ilike', '%'.$search.'%')
->orWhere('email', 'ilike', '%'.$search.'%');
$query->where('first_name', 'like', '%'.$search.'%')
->orWhere('last_name', 'like', '%'.$search.'%')
->orWhere('email', 'like', '%'.$search.'%');
});
})->when($filters['role'] ?? null, function ($query, $role) {
$query->whereRole($role);