skip to Main Content
  • PHP version: 7.3.9
  • Laravel version: 5.8.30
  • Package version: 3.1

Description

I am trying to export excel file. I do all things in the documentation and the process work with no errors. but the excel file does not download.. I’m using Ubuntu OS.

UserExport.php

<?php

 namespace AppExports;

 use AppUser;
 use MaatwebsiteExcelConcernsFromCollection;

 class UsersExport implements FromCollection
 {
    /**
     */
     public function collection()
     {
         return User::all();
      }
  } 

ExportExcelController.php

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;
use AppExportsUsersExport;

use MaatwebsiteExcelFacadesExcel;

class ExportExcelController extends Controller
{
    public function export() 
    {

        return Excel::download(new UsersExport, 'users.xlsx');
    }
}

2

Answers


  1. I was seeing the same behavior. I got around it by clearing out all caches and recreating the config cache.

    php artisan cache:clear
    php artisan route:clear
    php artisan view:clear
    php artisan config:cache
    
    Login or Signup to reply.
  2. I was using the package with inertia-vue and using an <a></a> in place of the <Link></Link> tag worked the trick

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search