State::let()

Deletes a state or states.

Table of Contents
  1. Description
  2. Example

Description

State::let(): void;
State::let(array $keys): void;
State::let(string $key): void;

This method deletes a state or states that was previously set. It is possible to use dot notation access if you want to delete the states recursively. To keep the dot character as part of the key, prefix it with a \.

Example

State::set([
    'bar' => 1,
    'baz' => true,
    'foo' => ['bar' => 5],
    'foo.bar' => 1,
    'qux' => [1, 2, 3]
]);

State::let('bar'); // Deletes `bar` state
State::let('foo.bar'); // Deletes `bar` state in `foo` state
State::let('foo\.bar'); // Deletes `foo.bar` state
State::let(); // Deletes all states
State::let(['bar', 'baz']); // Deletes `bar` and `baz` state
State::let(['bar' => 1]); // Deletes `bar` state only if its value is `1`
State::let([]); // Deletes all states

State::let()

Deletes a state or states.