Skip to content
Extra Laravel collection methods
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Initial commit Aug 4, 2019
tests
.gitignore
LICENSE
README.md
composer.json
phpunit.xml

README.md

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
You can’t perform that action at this time.