I have created a laravel helper something like this which generates an sql file in /sql/ under my database folder location so database/sqls/xxxxx.sql
class Helpsql {
public function cd(string $file = '')
{
$destinationFile = 'mysql';
$destinationPath = database_path(sprintf('sql/', $destinationFile));
$this->callerPassthrough('info', 'create file');
return $destinationPath;
}
}
I create a controller function like this AbcController.php
public function index(){
$urlpath = new Helpsql;
$urlpath->cd();
return response()->download($destinationPath);
}
My route is: Route::get('path', 'AbcController@index');
but it is not returning the path to download the file.