Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Jun 30, 2023
1 parent 8af0f04 commit 56ebda1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ The package will automatically register itself.
- [`firstOrFail`](#firstorfail)
- [`firstOrPush`](#firstorpush)
- [`fromPairs`](#frompairs)
- [`getCaseInsensitive`](#getcaseinsensitive)
- [`glob`](#glob)
- [`groupByModel`](#groupbymodel)
- [`hasCaseInsensitive`](#hascaseinsensitive)
- [`head`](#head)
- [`if`](#if)
- [`ifAny`](#ifany)
Expand Down Expand Up @@ -384,6 +386,20 @@ $collection = collect([['a', 'b'], ['c', 'd'], ['e', 'f']])->fromPairs();
$collection->toArray(); // returns ['a' => 'b', 'c' => 'd', 'e' => 'f']
```

### `getCaseInsensitive`

Get the value of a given key.

If the key is a string, we'll search for the key using a case-insensitive comparison.

```php
$collection = collect([
'foo' => 'bar',
]);

$collection->getCaseInsensitive('Foo'); // returns 'bar';
```

### `glob`

Returns a collection of a `glob()` result.
Expand All @@ -407,6 +423,20 @@ $posts->groupByModel('category');

Full signature: `groupByModel($callback, $preserveKeys, $modelKey, $itemsKey)`

### `hasCaseInsensitive`

Determine if the collection contains a key with a given name.

If $key is a string, we'll search for the key using a case-insensitive comparison.

```php
$collection = collect([
'foo' => 'bar',
]);

$collection->hasCaseInsensitive('Foo'); // returns true;
```

### `head`

Retrieves first item from the collection.
Expand Down

0 comments on commit 56ebda1

Please sign in to comment.