@@ -130,6 +130,72 @@ if ($payload->notIn('banned', 'deleted')) {
130130
131131---
132132
133+ ### ` is(...$checks): bool `
134+
135+ Run multiple ` is* ` checks and return ** true only if all of them pass** .
136+ Supports negation using ` ! ` at the start of the check.
137+
138+ ``` php
139+ if ($payload->is('!empty', 'string')) {
140+ // value is not empty AND is a string
141+ }
142+
143+ if ($payload->is('!null', 'numeric')) {
144+ // value is NOT null AND is numeric
145+ }
146+ ```
147+
148+ You can also reference existing ` is* ` methods implicitly:
149+
150+ ` 'notEmpty' ` → ` isNotEmpty() `
151+ ` 'json' ` → ` isJson() `
152+ ` '!empty' ` → negated ` isEmpty() `
153+
154+ ---
155+
156+ ### ` isAny(...$checks): bool `
157+
158+ Run multiple ` is* ` checks and return ** true if any one of them passes** .
159+ Also supports negation with ` ! ` .
160+
161+ ``` php
162+ if ($payload->isAny('json', 'array')) {
163+ // value is json OR array
164+ }
165+
166+ if ($payload->isAny('!empty', 'true')) {
167+ // value is not empty OR equals true
168+ }
169+ ```
170+
171+ Same rules apply for automatic method mapping and negation.
172+
173+ ---
174+
175+ ### ` isEmptyString(): bool `
176+
177+ Check if the payload is an empty string.
178+
179+ ``` php
180+ if ($payload->isEmptyString()) {
181+ // skip filter
182+ }
183+ ```
184+
185+ ---
186+
187+ ### ` isNotNullOrEmpty(): bool `
188+
189+ Check if the payload is neither null nor empty.
190+
191+ ``` php
192+ if ($payload->isNotNullOrEmpty()) {
193+ // apply filter
194+ }
195+ ```
196+
197+ ---
198+
133199### ` isBoolean(): bool `
134200
135201Check if the value can be interpreted as boolean.
@@ -166,6 +232,17 @@ $payload->asBoolean(); // true or false
166232
167233---
168234
235+ ### ` asSlug(string $operator = "-"): string `
236+
237+ Convert the payload value to a slug.
238+
239+ ``` php
240+ $payload->asSlug(); // "my-sample-value"
241+ $payload->asSlug("_"); // "my_sample_value"
242+ ```
243+
244+ ---
245+
169246### ` asLike(string $side = "both"): string `
170247
171248Wrap the value with ` % ` for SQL ` LIKE ` queries.
@@ -191,6 +268,26 @@ $payload->asInt(); // 42
191268
192269---
193270
271+ ### ` explode(string $delimiter = ","): array `
272+
273+ Split the value into an array using the given delimiter.
274+
275+ ``` php
276+ $payload->explode(); // ['one', 'two', 'three']
277+ ```
278+
279+ ---
280+
281+ ### ` split(string $delimiter = ","): array `
282+
283+ Alias for ` explode() ` method.
284+
285+ ``` php
286+ $payload->split(); // ['one', 'two', 'three']
287+ ```
288+
289+ ---
290+
194291### ` raw(): mixed `
195292
196293Get the original unmodified value.
@@ -259,6 +356,42 @@ $payload->isFalse();
259356
260357---
261358
359+ ### ` regex(string $pattern): bool `
360+
361+ Check if the value matches the given regular expression pattern.
362+
363+ ``` php
364+ if ($payload->regex('/^[a-z0-9]+$/i')) {
365+ // value contains only alphanumeric characters
366+ }
367+ ```
368+
369+ ---
370+
371+ ### ` isDate(): bool `
372+
373+ Check if the value is a valid date string.
374+
375+ ``` php
376+ if ($payload->isDate()) {
377+ $this->builder->whereDate('created_at', $payload->value);
378+ }
379+ ```
380+
381+ ---
382+
383+ ### ` isTimestamp(): bool `
384+
385+ Check if the value is a valid timestamp.
386+
387+ ``` php
388+ if ($payload->isTimestamp()) {
389+ // value is a valid timestamp
390+ }
391+ ```
392+
393+ ---
394+
262395### ` asArray(): array `
263396
264397If the value is a valid JSON string representing an array/object, it will be decoded into an array.
@@ -270,6 +403,16 @@ $payload->asArray();
270403
271404---
272405
406+ ### ` asCarbon(): Carbon|null `
407+
408+ Get the payload value as a Carbon instance.
409+
410+ ``` php
411+ $payload->asCarbon();
412+ ```
413+
414+ ---
415+
273416### ` toArray(): array `
274417
275418Get the instance as an array
0 commit comments