laravel excel avoid scientific notation for long numbers

Solutions on MaxInterview for laravel excel avoid scientific notation for long numbers by the best coders in the world

showing results for - "laravel excel avoid scientific notation for long numbers"
Abril
29 Jan 2021
1// in database		: 1277192403076020
2// in exported excel: 1,27719E+15
3
4// how do i prevent that?
5// here example:
6
7<?php
8
9namespace App\Exports\Pages;
10
11use App\Models\YourModel;
12use Maatwebsite\Excel\Concerns\FromCollection;
13use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
14use Maatwebsite\Excel\Concerns\WithColumnFormatting;
15
16class PicsExport implements FromCollection, WithColumnFormatting
17{
18  	public function collection(){
19    	// ...
20    }
21  
22	public function columnFormats(): array{
23        return [
24            'A' => NumberFormat::FORMAT_NUMBER, // add this
25        ];
26	}
27  
28}