I want to gather all the tags' ids whose names are in an array. For that I'm using whereIn like so:
$tags = Category::whereIn('name', $tag_names)->pluck('id')->toArray();
I works perfectly but I doesn't have an option (that I know of) that makes the operator of whereIn case-insentive.
$tag_names are an array of tag names which have arbitrary casing.
'name' is the column that holds the name of the tag in the database and has specific casing that may not match the one in $tag_names.
My postgresql schema for the Categorytable is:
CREATE TABLE categories (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL UNIQUE,
description TEXT,
num_posts INTEGER DEFAULT 0 NOT NULL
);
whereIn('LCASE(name)',strtolower($tag_names))array_map('strtolower', $tag_names). Secondly, the first argument throws a Postgresql error, even if I try it withlowerinstead ofLCASE. Thank you anyway for trying to help!