Level 122
you use a where statement
write some code for review...
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a $ table-> text ('status') field that can take cat, dog, rabbit, t-rex (it's just these 4) I would like to query that orders for rabbit, dog, t-rex, cat?
clearly it must not be a lexicographical order. IF IT WERE an ENUM type field I would order like this:
$exampleEnum = DB::table('polls')->orderByRaw('FIELD(status, "rabbit", "dog","t-rex","cat")asc')->orderBy('created_at', 'asc')->get();
BUT the field is TEXT TYPE
Please or to participate in this conversation.