mardi 21 août 2018

Relation between a Laravel Command and a Job

Let's say I have a long-lived process to run "Backup Database 1"

  • I want that to run in every night. (and see result in log)

  • Also, I want to run it manually sometimes via Artisan Command. (see result in command line)

  • Also, I need an html button to run it in my HTML Interface. (see result in screen)

What's the best approach?

  1. Should a Job call the Artisan Command?
  2. Should an Artisan Command call a Job?
  3. Should both call a third Class?
  4. Should the html button call a Job and then output the log file?

Notes:

Laravel documentation says you can execute commands in the queue, adding more confusion.

I tried the example, but the --queue option is not automatically implemented

https://laravel.com/docs/5.6/artisan#programmatically-executing-commands

Artisan::queue('email:send', [
        'user' => 1, '--queue' => 'default'
    ]);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire