I'm using Laravel 5.8 and I tried creating a custom command like this:
php artisan make:command app exportappresults
And the Command goes like this:
protected $signature = 'app:exportappresults';
protected $description = 'Export App Exam Result Into Excel';
public function __construct()
{
parent::__construct();
}
public function handle()
{
return Excel::download(new TavanmandAppUserExamExport,'userexamlist.xlsx');
}
So as you can see I have used Laravel Excel and tried exporting data into Excel file.
Note that this code works fine in the Controller and can properly export an Excel file.
But now I don't know where does the exported excel file from the DB goes when I use the Console Command.
So if you know, please let me know...
Thanks.