Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel check if item is in collection

// you may pass a string to the contains method to determine whether
// the collection contains a given item value:

$collection = collect(['name' => 'Desk', 'price' => 100]);

$collection->contains('Desk');
// true

$collection->contains('New York');
// false
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #check #item #collection
ADD COMMENT
Topic
Name
3+7 =