I need to add and operation to handle downloading of a file.
How can i create route, and add setupDownloadOperation in the right way?
Or must I simply do 'laravel-way' manually adding a route?
I need to add and operation to handle downloading of a file.
How can i create route, and add setupDownloadOperation in the right way?
Or must I simply do 'laravel-way' manually adding a route?
Actually we did this
First - Create a setupDownloadRoutes
Actually this is called automatically ad boot
protected function setupDownloadRoutes($segment, $routeName, $controller)
{
Route::get($segment. '/{id}/download', [
'as' => $routeName . '.download',
'uses' => $controller . '@download',
'operation' => 'download',
]);
}
Create the setupDownloadOperation function
It's automatically launched if found. If you have nothing to do here you can avoid to create it.
protected function setupDownloadOperation()
{
...do things here...
}
Create the download function.
This is the classic controller action of Laravel
protected function download()
{
... do thing as usually in a normal action ...
}
I do not find these procedure documented actually
The docs here cover exactly what you need. Just replace “moderate” with “download” in the naming - https://backpackforlaravel.com/docs/4.1/crud-operations