Users who have contributed to this file

Invocables

Invocables are ubiquitous classes that all of Coravel's features understand how to work with.

Invocables allow you to define specific self-contained jobs within your system. Since Coravel "understands" how to use invocables, you can do cool stuff like schedule or queue them using a super terse syntax.

Example: Generating A Daily Report And Emailing To Users

In this example, SendDailyReportsEmailJob is an invocable that was created by us. It handles getting data (via some repository that was injected via DI) and generating an e-mail, etc.

A sample implementation of the SendDailyReportsEmailJob class might look something like this (which is using Coravel's Mailer to send e-mail):

Example: Trigger Long Running Calculations In Background

You might have a use-case where - from an admin screen - you want to have an HTML button that will fire off an expensive
calculation - at least too long to let your users wait for it to finish. Once completed, it might save the results to a database.

Assuming you created an invocable DoExpensiveCalculationAndStoreInDB, you could run it like this: