如何使用chunk()返回记录?

时间:2019-02-08 00:51:40

标签: laravel

我正在使用chunk()根据问题从数据库中查找值。但是,如何返回entityFound[]数组?

$chunkRecord = $this->company()->entityValues()->chunk(5,
    function ($entityValues) use ($entityFound, $question) {
        foreach ($entityValues as $entityValue)
            if (str_contains($question, $entityValue->name))
                $entityFound[] = $entityValue->name;

        return $entityFound;
    });

//  I want to run this array and do something else.
dd($entityFound);

0 个答案:

没有答案