ideas
ideas copied to clipboard
Support for first_name last_name instead of name when searching for an Eloquent User.
Statamic supports first_name and last_name for a signup, etc, but it's not when searching for users. I am using Statamic with users in a database.
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select count(*) as aggregate from users where (email like %dsdd% or name like %dsdd%) and users.deleted_at is null)
I get around this by making a 'name' column with a trigger that concatenates both first_name and last_name
ALTER TABLE 'users' ADD COLUMN 'name' varchar(255) AS (CONCAT(first_name,' ',last_name)) STORED AFTER last_name;
Seems to work fine, but would be good to have native support
I'm unable to reproduce this issue on the latest version of Statamic. I can search by first_name and last_name columns just fine, as long as the fields exist in my user blueprint.
I'm going to close this issue now. If you're still experiencing this issue, please leave a comment and we can re-open the issue. Thanks!