More than one Export

Is it possible to have more than one export? So the client can go to the backend list and choose between 2 export buttons. Each one would export a different set of columns based on different queries we setup in the model. Or is there a better way of doing this (ie: create a new plugin that access the original model and set the query there)?


Maybe it will help you

I described how it is possible to export based on a filter.

Try to connect it with this plugin

Hi - thanks. I’m looking for something simple for the client. Basically, 2 export buttons that perform different types of exports. So I tried using a parameter to the link ie: ?type=data and using Input::get. performing different queries, which worked.

Next issue - one of the fields is a $belongtomany, so is there a way to get the values (names) into the export column? I found a link to do it for $belongsto (Export with relations - October CMS).

Thanks for all of your help.

For anyome who has a similar issue - this worked:

return Donation::all()->each(function($item){
                $item->user_type_name = $item->usertypes->pluck('name')->implode(', ');
                return $item;

Donation is the model.

The usertypes was set up in the model as a $belongsToMany.

The user_type_name is the export column which shows the names.

Hope this helps.

1 Like

thanks to share with this information :+1: