Skip to content

Latest commit

 

History

History
63 lines (37 loc) · 1.06 KB

README.md

File metadata and controls

63 lines (37 loc) · 1.06 KB

Extra Collect

Some extra Laravel collection methods.

composer require chrisrhymes/extra-collect

Contents

Collection Methods

Prefix

collect(['a', 'b', 'c'])->prefix('test');

// ['testa', 'testb', 'testc']


collect([['name' => 'a'], ['name' => 'b'], ['name' => 'c']])->prefix('test', 'name');

// [['name' => 'testa'], ['name' => 'testb'], ['name' => 'testc']]

Suffix

collect(['a', 'b', 'c'])->suffix('test');

// ['atest', 'btest', 'ctest']


collect([['name' => 'a'], ['name' => 'b'], ['name' => 'c']])->suffix('test', 'name');

// [['name' => 'atest'], ['name' => 'btest'], ['name' => 'ctest']]

Double Quote

collect(['a', 'b', 'c'])->doubleQuote();

// ['"a"', '"b"', '"c"']


collect([['name' => 'a'], ['name' => 'b'], ['name' => 'c']])->doubleQuote('name');

// [['name' => '"a"'], ['name' => '"b"'], ['name' => '"c"']]

Testing

composer test