Laravel Nova Excel 1.1 — Ready for launch

Patrick Brouwers
Oct 30, 2018 · 2 min read

Two months ago we released a first version of Laravel Nova Excel that exports Nova resources to Excel. At Maatwebsite we still love Laravel Nova and couldn’t wait to extend our package even more!

Export what you see

Our main focus on this release was to try and get the data you see in the resource index screen to be exactly the same in the export. This meant we needed to redesign some of the internals that made the translation from Resources to our Laravel Excel library.

User resource index screen
Exported users

In our opinion the most valuable addition is the possibility to export relation values. All BelongsTo relations added to the Resources fields will now be displayed in the same way as on the index screen.

BelongsTo::make('User'),

Alternatively you can also eager-load the relation and access its data.

public static $with = ['user'];public function fields(Request $request)
{
return [
Text::make('User Name', 'user.name'),
];
}

Another new addition is the possibility to export computed fields. They will be displayed just the same as in your index view.

Text::make('Random number', function () {
return str_random();
}),

Laravel Nova Excel 1.1 now also calls display callbacks. All changes you have made to display the field in the index view will now also be respected when exporting.

Text::make('Name')
->displayUsing(function ($value) {
return strtoupper($value);
})

We also took the time to improve the integration with lenses. Lenses will now also be exported with the same features as described above!

When using ->withHeading() on the export action, it will now use the Field name instead of the attribute name. It’s still possible to override the heading row by passing the values in the ->withHeadings(['heading-1']) method.

(new DownloadExcel())->withHeadings(),

You can read more about Laravel Nova Excel in our dedicated documentation: https://laravel-excel.maatwebsite.nl/nova/1.1/getting-started/


Do you need help with integrating Laravel (Nova) Excel or do you need help building a Laravel application? At Maatwebsite, we are there to help you on a commercial basis. Contact us via info@maatwebsite.nl or via phone +31 (0)10 744 9312 to discuss the possibilities.

Maatwebsite

Professional Software Development

Patrick Brouwers

Written by

Loves building awesome things in Laravel, VueJS and TailwindCss. Working @ Maatwebsite. Maintainer of Laravel Excel.

Maatwebsite

Professional Software Development

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade