We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3dc9868 commit 8cac5e9Copy full SHA for 8cac5e9
1 file changed
lib/Relation.php
@@ -169,6 +169,21 @@ public function joins(string|array $joins): Relation
169
}
170
171
/**
172
+ * Applies an ```ORDER BY``` clause to a query.
173
+ *
174
+ * This could be a source of SQL injection, so only strings composed of plain
175
+ * column names and simple ```function(column_name)``` expressions
176
+ * with optional ASC/DESC modifiers are allowed.
177
178
+ * User::order('name') // SELECT "users".*
179
+ * // FROM "users" ORDER BY name
180
181
+ * User::order('name DESC') // SELECT "users".*
182
+ * // FROM "users" ORDER BY name DESC
183
184
+ * User::order('name DESC, email') // SELECT "users".*
185
+ * // FROM "users" ORDER BY name DESC, email
186
187
* @return Relation<TModel>
188
*/
189
public function order(string $order): Relation
0 commit comments