fast-excel icon indicating copy to clipboard operation
fast-excel copied to clipboard

custom output for boolean columns export

Open p1xel007 opened this issue 4 years ago • 1 comments

I have boolean columns in my db, when I export I want to replace boolean with custom words like YES/NO

Is that possible?

p1xel007 avatar Feb 06 '22 08:02 p1xel007

Yes. You can do something like this

(new FastExcel(User::all()))->export('users.csv', function ($user) {
    return [
        'my column name' => $user->myBooleanVariable ? 'YES' : 'NO',
        // Then the rest of your columns
    ];
}); 

rap2hpoutre avatar Mar 06 '22 20:03 rap2hpoutre