'Laravel Eloquent toArray method

I add the toArray() method because I need the result in an array format; it displays the error below. So I wonder how I can fix it? How can I create that query in an array?

HrHorizontalPreviredCalculation::from('hr_horizontal_previred_calculations')
    ->selectRaw('`Rut`,`DV`,`Apellido Paterno`,`Apellido Materno`,`Nombre`,`Sexo`,`Nacion`,`Tipo Pago`,`Periodo Desde`,`Periodo Hasta`,`Regimen`,`Tipo Trabajador`,`Dias Trabajados`,`Tipo Linea`,`Cod Movi`,`Fecha Desde`,`Fecha Hasta`,`Tramo Fam`,`Cargas Simples`,`Cargas Mat`,`Cargas Inv`,`Asig Familiar`,`Asig RetroAct`,`Reint Cargas`,`Sub Trab Jov`,`AFP`,`Impo Afp`,`Cot AFP`,`Aporte SIS`,`Ahorro AFP`,`Sust AFP`,`Tasa Pac AFP`,`Aporte idem`,`Num Per Sust`,`Per Desde Sust`,`Per Hasta Sust`,`Trab Pesado`,`% Trab Pesado`,`Cot Trab Pesado`,`Inst APVI`,`Num Contra APVI`,`Forma Pago APVI`,`Cotiza APVI`,`Cot Dep Conv`,`Inst APVC`,`Num Contra APVC`,`Forma Pago APVC`,`Cotiza APVC`,`Cot Emp APVC`,`Rut afi Volun`,`DV afi Volun`,`Ape Pat Volun`,`Ape Mat Volun`,`Nombre volun`,`Cod Mov Per`,`Fec Desde volun`,`Fec Hasta volun`,`Cod Afp volun`,`Monto Cap Volun`,`Monto aho Vol`,`Num Per Cotiza`,`Cod Ex caja`,`Tasa ex caja`,`Renta imp Fonasa`,`Cod INP`,`Renta desahu`,`Cod ex caja des`,`Tasa ex caja des`,`Cot Desahucio`,`Cotiza Fonasa`,`Cot Acc Trab INP`,`Boni Ley`,`Cargas fam INP`,`Bonos Gob`,`Cod Inst Salud`,`Num FUN`,`Impo Isapre`,`Moneda Plan`,`Cot Pactada`,`Cot Obli Isapre`,`Cot Ad Vol`,`Monto Ges`,`Cod CCAF`,`Impo CCAF`,`Cred Per CCAF`,`Desc Dental`,`Desc Leasing`,`Desc Seg Vida`,`Otros desc CCAF`,`Cot CCAF`,`Car Fam CCAF`,`Otros desc CCAF1`,`Otros desc CCAF2`,`Bono gob CCAF`,`Cod Sucur CCAF`,`Cod Mutual`,`Impo Mutual`,`Cotiza Mutual`,`Sucur Mutual`,`Renta Impo SC`,`Aporte Trab SC`,`Aporte empleador`,`Rut Pag Subs`,`DV Pag Subs`,`Centro costo`')
    ->where('period', $period)
    ->orderBy('employee_id', 'ASC')
    ->get();

message: "Call to undefined method Illuminate\Database\Eloquent\Builder::toArray()"



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source