This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

raymond67641
raymond67641

I have club table and user table. club hasMany user and I was using partial to show the user table in club Forms. I created toolbarPartial: user_toolbar and added export button in toolbar. I can export the user data but only all user data. How can I filter the user by club? Thank you.

Last updated

daftspunky
daftspunky

Hi Raymond,

To control the export data, you can define an export model to apply constraints to the query used for collecting data. Here is a link to the relevant documentation article:

https://docs.octobercms.com/2.x/backend/import-export.html#defining-an-export-model

I hope this helps!

raymond67641
raymond67641

Thanks for your help.

I created the UserExportModel and public function exportData, it can constraints to the query in where club_id = 1 in hardcoded but cannot get club_id to UserExportModel.

How can I get club_id in club to UserExportModel or through toolbar export button get club_id?

Sam Georges
Sam Georges

You could access it using the post() or get() helpers.

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.