我正在使用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);