0
$arrayCarros = [];    
$model = new Carros();
$carros = $model->with('montadoras')->cursor();
foreach($carros as $carros) {
    array_push($arrayCarros, $carro->toArray());
}
Running the above code, I get the following output:
        [
            [
                'id' => 1,
                'modelo' => 'Fit',
                'ano' => 2015
            ]
        ]
However, if I run the code below:
$arrayCarros = [];    
$model = new Carros();
$carros = $model->with('montadoras')->toArray();
I get the following output:
        [
            [
                'id' => 1,
                'modelo' => 'Fit',
                'ano' => 2015,
                'montadoras' => [
                    'id' => 1,
                    'montadora' => 'Honda'
                ]
            ]
        ]
Is there any way to return the associated data together to function cursor of Laravel?
From what I could perceive it only carries by calling the method of relationship, and this is not good, it is better to work with
get,all, I found nothing conclusive even on Laravel’s website, which has only one small example.– novic
@Virgilionovic - I live up to your words. 'cursor()' is an extremely interesting and useful feature, especially when we are working with large amounts of data. It will be a shame not to be able to use this resource and associated data set. I will continue searching.
– Max Porcento