examples/RealWorldExample.php
protected function findProductItem(Collection $items, $key)
    {
        if ($key instanceof ItemModel) {
            $key = $key->getKey();
        }

        return $items->first(function($id, $item) use($key) {
            return $item->product_id == $key;
        });
    }
protected function findProductItem(Collection $items, $key)
    {
        if ($key instanceof ItemModel) {
            $key = $key->getKey();
        }

        return $items->first(function($id, $item) use($key) {
            return $item->product_id == $key;
        });
    }
Find the item entry of a specific product key in a collection of items.

@param  \Illuminate\Database\Eloquent\Collection $items
@param  mixed                                    $key   The product's primary key.

@return \REDACTED\Wastage\ItemModel|null