Trying to create a download button for my table builder but it isn't working

edster - 2 weeks ago

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);
    }

Answer

- 2 weeks ago

Once again, thanks @craigberry

its href not url

edster - 2 weeks ago

Once again, thanks @craigberry

its href not url

ryanthompson - 2 weeks ago

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