Generate PDF From Collection Relation Manager ( Step By Filament Daily)
hi all, i create action to export data from relation manager . im trying to follow step according what filament daily show in their website https://laraveldaily.com/post/filament-export-record-to-pdf-two-ways.
my problem is . i wanted to generate pdf based on Collection without i need to tick one by one. it will get all collection record from my relation manager by default . how to do that ?
13 Replies
Anyone can help?
If I understand you need to export all collection in one pdf right?
Yes
Its working
But the problem is i need to select first in order to let the data in pdf to be generated
I want to let all the data in relation manager will generate without i need to select
Why you are not using the ExportAction from Filament itself?
Because first i want to generate in pdf
Second, i need to use custom design for the report table
Do you have an idea to let convert in pdf and use custom view by using export action?
In this situation I don't think that let you to customize the template, but you can use another libraries such as Laravel Excel
https://docs.laravel-excel.com/3.1/exports/
🚀 5 minute quick start | Laravel Excel
Supercharged Excel exports and imports in Laravel
I think your
->action()
will still work using Action (header action in listResource) but need to tweak a little bit
oh wait, didn't see "relation manager"..Same as you was in beginning, but is "Relation Manager"
Can you try like this:
And you can use
$this->getOwnerRecord()->getKey()
to get the parent id for filterTo generate is working as long as i select the id and run the action . I just wondering how to generate without i need to select . Its like auto capture all the data in relation manager by default when generating
Did you try my action example? all you have to do is click the button and it will download if you configure correctly
Havent yet . I will try . Get back to you later