Skip to content

Conversation

@thyseus
Copy link
Collaborator

@thyseus thyseus commented Dec 24, 2021

No description provided.

@marksalmon
Copy link
Collaborator

Thanks,

I haven't used table prefixes in Laravel before.

Do you not need to concatenate an extra '.' between the prefix and the column name?

$query->whereRaw('LOWER(' . ($this->tablePrefix ? $this->tablePrefix . '.' : '') . $column . ') like ?', [mb_strtolower("%$value%")]);

instead of:

$query->whereRaw('LOWER(' . $this->tablePrefix . $column . ') like ?', [mb_strtolower("%$value%")]);

@thyseus
Copy link
Collaborator Author

thyseus commented Jan 6, 2022

Actually having a . inside a sql table name is very uncommon. Never encountered that in my life. _ is common. I am not even sure if SQL supports that. If you need a . inside your sql tables you would write it in your variable like TABLE_PREFIX=prefix..

I use this code in a project already in production :)

@marksalmon
Copy link
Collaborator

marksalmon commented Jan 6, 2022 via email

@marksalmon marksalmon merged commit 098fb1b into MedicOneSystems:master Jan 6, 2022
@zachary
Copy link

zachary commented Jan 12, 2022

Could you please let me how to fix the issue? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants