だから私は変数とレコードセットを持っています:
$firstRecordID = 1;
$records = Recordset::all();
レコードセットをフィルター処理したい:
$filteredRecords = $records->find(function($record) use ($firstRecordID){
return ($record->id == $firstRecordID);
});
この例では、レコード ID が主キーであると仮定すると、返される行は 1 行だけですが、フィルターは継続すると思います。
私の質問は、特定の条件が満たされた後にフィルターを強制的に停止するにはどうすればよいですか?
編集:別のより複雑な例を追加します:
$filteredRecords = $records->find(function($record) use ($lastRecordID){
$conditions == $records->conditions;
// in here I would find some value
// based on some other unknown record based on the $conditions
// if the value matches any of the $conditions return the row
// if the value matches a specified stop condition
// (which is defined by the user) stop retrieving rows.
});