Answers for "laravel collection not in"

PHP
1

add to collection laravel

$item = collect();
$item->push($product);
Posted by: Guest on November-24-2020
0

pluck laravel

$name = DB::table('users')->where('name', 'John')->pluck('name');
Posted by: Guest on January-18-2021
0

laravel collection whereNotIn

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

$filtered = $collection->whereNotIn('price', [150, 200]);

$filtered->all();

/*
    [
        ['product' => 'Chair', 'price' => 100],
        ['product' => 'Door', 'price' => 100],
    ]
*/
Posted by: Guest on July-24-2021

Code answers related to "laravel collection not in"

Browse Popular Code Answers by Language