Created
September 18, 2019 02:47
-
-
Save shrestharikesh/fc4df845f76caff2874f6b437d0fce69 to your computer and use it in GitHub Desktop.
Helpful Laravel Custom Helper Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* case insensetive filter for collection | |
*/ | |
if (!function_exists('collectionFilter')) { | |
function collectionFilter($collection,$attribute,$value) | |
{ | |
return $collection->filter(function ($item) use ($attribute, $value) { | |
return strtolower($item[$attribute]) == strtolower($value); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment