Trying to create a download button for my table builder but it isn't working
Created 7 years ago by edster

So the code I have below is basically working, except the URL part, even if I hard-code in a URL, it doesn't work :/

public function handle(DocumentTableBuilder $builder)
    {
        $buttons = [
            'download' => [
                'url'  => function ($entry) {
                    return url('/commercial_portal' . $entry['document']->folder . $entry['document']->name);
                },
                'text' => 'Download',
                'icon' => 'fa fa-download',
                'type' => 'success',
            ],
        ];

        $builder->setButtons($buttons);
    }
edster  —  7 years ago Best Answer

Once again, thanks @craigberry

its href not url

ryanthompson  —  7 years ago

Ya think of them as definitions for the HTML/objects them selves. Links don't have URL they have HREF properties 😊