File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -118,9 +118,12 @@ public function sort($field, $direction = 'asc')
118118 }
119119
120120 /**
121- * Apply multiple sorts to the query builder.
121+ * Apply multiple sort directives to the underlying query builder.
122122 *
123- * @param array $sorts An array of sorts to apply.
123+ * Each element must be an array with a 'field' key and an optional 'direction' key
124+ * (defaults to 'asc'); each directive is forwarded to sort().
125+ *
126+ * @param array $sorts Array of sort directives.
124127 */
125128 public function applySorts ($ sorts )
126129 {
@@ -129,6 +132,15 @@ public function applySorts($sorts)
129132 }
130133 }
131134
135+ /**
136+ * Apply soft-delete visibility to the underlying Scout query builder.
137+ *
138+ * Sets the query to include only soft-deleted records when `$trashed` is `"only"`,
139+ * or to include both deleted and non-deleted records when `$trashed` is `"with"`.
140+ * Any other value is ignored (no change).
141+ *
142+ * @param string $trashed One of: "only" (only trashed), "with" (include trashed), or other (no-op).
143+ */
132144 public function applyTrashed (string $ trashed ): void
133145 {
134146 if ($ trashed === 'only ' ) {
Original file line number Diff line number Diff line change 77
88class SearchText extends RestRule
99{
10+ /**
11+ * Build Laravel validation rules for a search input attribute.
12+ *
13+ * Returns rules that either prohibit the attribute when the resource is not model-searchable,
14+ * or validate a nested search payload structure when searchable:
15+ * - `<attribute>`: optionally present and must be an array.
16+ * - `<attribute>.value`: nullable string (the search text).
17+ * - `<attribute>.trashed`: must be one of `'with'` or `'only'`.
18+ *
19+ * @param string $attribute The root attribute name to validate (e.g. "search").
20+ * @param mixed $value Unused by this rule builder; present to match the rule interface.
21+ * @return array<string, array<int, mixed>> Laravel validation rules keyed by attribute path.
22+ */
1023 public function buildValidationRules (string $ attribute , mixed $ value ): array
1124 {
1225 if (!$ this ->resource ->isModelSearchable ()) {
You can’t perform that action at this time.
0 commit comments