What is the Laravel Cursor?

devquora
devquora

Posted On: Feb 22, 2018

 

The cursor method in the Laravel is used to iterate the database records using a cursor. It will only execute a single query through the records. This method is used to reduce the memory usage when processing through a large amount of data.

Example of Laravel Cursor

foreach (Product::where(‘name’, ‘Bob’)->cursor() as $fname) {
//do some stuff
}

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Laravel interview questions

    What is Laravel?

    Laravel is a free open source "PHP framework" based on the MVC design pattern. It is created by Taylor Otwell...