Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel check if item is in collection

// You may also pass a key / value pair to the contains method,
// which will determine if the given pair exists in the collection:

$collection = collect([
    ['product' => 'Desk', 'price' => 200],
    ['product' => 'Chair', 'price' => 100],
]);

$collection->contains('product', 'Bookcase');
// false
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #check #item #collection
ADD COMMENT
Topic
Name
1+6 =