Skip to content

Custom Action "Download PDF" button #5289

Answered by DevMushref
DevMushref asked this question in Help
Discussion options

You must be logged in to vote

Got it!!

Instead of using ->action(), use ->url()

domPDF needs a controller and a route in order to generate PDFs correctly.

First off, create a route:

Route::prefix('generate-pdf')->name('generate-pdf.')
    ->group(function () {
        Route::controller(generatePDF::class)->group(function () {
            Route::get('incident-report/{record}', 'incidentReport')->name('incident.report'); // Incident Reports
        });
    });

I created a route group called generate-pdf so within it I will create routes that redirects to the controller which contains methods of generating different PDF files based on Filament resource. In my case I only have 1 for now which is:

Route::get('incident-rep…

Replies: 5 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@DevMushref
Comment options

@ArtMin96
Comment options

@DevMushref
Comment options

@ArtMin96
Comment options

@danharrin
Comment options

Comment options

You must be logged in to vote
3 replies
@ArtMin96
Comment options

@DevMushref
Comment options

@ArtMin96
Comment options

Comment options

You must be logged in to vote
2 replies
@elysdan
Comment options

@elysdan
Comment options

Answer selected by DevMushref
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants