1

We are running a command where the data is fetched. And we want to create the excel with charts in it which nee to be sent as attachment. When executing the command nothing happened. Can anyone please help me.

    public function handle()
    {
        try{
            Excel::download(new emailTriggerExport,'exportTrigger.xlsx');
        }catch(Exception $e){
            dd($e);
            Log::error('EmailReportTrigger-command () : '.$e->getMessage());
            return false;
        }
        
    }

2
  • The command is executed in cli mode, no Response Download can be Created. You can store the Excel in file system and attach to Mail or some way getting the url and download. Commented Aug 10, 2022 at 19:26
  • as u can see i have used download which is expeted to download the file named emailtrigger.xlsx but nothing happen Commented Aug 11, 2022 at 4:57

1 Answer 1

1

simply add return

    public function handle()
    {
        try{
            return Excel::download(new emailTriggerExport,'exportTrigger.xlsx');
        }catch(Exception $e){
            dd($e);
            Log::error('EmailReportTrigger-command () : '.$e->getMessage());
            return false;
        }
        
    }

Here's a link!

Sign up to request clarification or add additional context in comments.

1 Comment

it retturns Object of class Symfony\Component\HttpFoundation\BinaryFileResponse could not be converted to int

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.