The cursor method allows us to iterate through our database using a cursor, which will only execute a single query. While processing large amounts of data, the cursor method may be used to reduce your memory usage greatly.
Example :
foreach (Product::where('name', 'bar')->cursor() as $flight) {
//make some stuff
}