On this page
Has
trait Has (View source)
Methods
Has | count(string|int $key, int $length = null) Assert that the prop is of the expected size. |
|
Has | has(string|int $key, int|Closure|null $length = null, Closure $callback = null) Ensure that the given prop exists. |
|
Has | hasAll(array|string $key) Assert that all of the given props exist. |
|
Has | hasAny(array|string $key) Assert that at least one of the given props exists. |
|
Has | missingAll(array|string $key) Assert that none of the given props exist. |
|
Has | missing(string $key) Assert that the given prop does not exist. |
|
string | dotPath(string $key = '') Compose the absolute "dot" path to the given key. |
|
void | interactsWith(string $key) Marks the property as interacted. |
|
mixed | prop(string $key = null) Retrieve a prop within the current scope using "dot" notation. |
|
$this | scope(string $key, Closure $callback) Instantiate a new "scope" at the path of the given key. |
|
$this | etc() Disables the interaction check. |
|
$this | first(Closure $callback) Instantiate a new "scope" on the first element. |
Details
Has count(string|int $key, int $length = null)
Assert that the prop is of the expected size.
Has has(string|int $key, int|Closure|null $length = null, Closure $callback = null)
Ensure that the given prop exists.
Has hasAll(array|string $key)
Assert that all of the given props exist.
Has hasAny(array|string $key)
Assert that at least one of the given props exists.
Has missingAll(array|string $key)
Assert that none of the given props exist.
Has missing(string $key)
Assert that the given prop does not exist.
abstract protected string dotPath(string $key = '')
Compose the absolute "dot" path to the given key.
abstract protected void interactsWith(string $key)
Marks the property as interacted.
abstract protected mixed prop(string $key = null)
Retrieve a prop within the current scope using "dot" notation.
abstract protected $this scope(string $key, Closure $callback)
Instantiate a new "scope" at the path of the given key.
abstract $this etc()
Disables the interaction check.
abstract $this first(Closure $callback)
Instantiate a new "scope" on the first element.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Testing/Fluent/Concerns/Has.html