0

I am using Nova and Laravel-Nova-Excel.

I need to export the contents of a nova-resource (+ add any filters) by cron on disk, as Excel. How to do it right?

Now I see this option:

  1. Get the query builder from the resource (how to do it? - the main problem)
  2. Create a query class as described here - https://docs.laravel-excel.com/3.1/exports/from-query.html
  3. Export the file.

Does anyone know other options?

1 Answer 1

0

You would like to export all the models connected to a certain nova-resource to excel from a cron job. Please correct me if I misinterpreted your question.

Laravel-Nova-Excel package is a nova wrapper around Laravel Excel. It will be easier to just use the package directly instead of the nova wrapper.

  • Use this guide Laravel Excel - quick start to define a Excel ExportModel class in which you define your filter logic.

  • Create a Laravel Command in which you trigger the ExportModel class. The following artisan command can be used to generate a laravel command : php artisan make:command ExportModel

    • Use this command in your existing cronjob: php artisan command:export
    • Or use the built in laravel schedules laravel schedules
Sign up to request clarification or add additional context in comments.

Comments

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.