Skip to content

Instantly share code, notes, and snippets.

@cod3beat
Created November 17, 2015 07:17
Show Gist options
  • Save cod3beat/a2bb0137c7900cb8f61e to your computer and use it in GitHub Desktop.
Save cod3beat/a2bb0137c7900cb8f61e to your computer and use it in GitHub Desktop.
Menjalankan Command di luar controller
<?php
use Dicoding\ApplicationService\Administration\NotifyPendingTaskCommand;
use Illuminate\Console\Command;
class DailyTaskNotifier extends Command
{
// code lain disembunyikan agar contoh ini menjadi lebih ringkas
public function fire()
{
try {
$commandBus = App::make('Laracasts\Commander\CommandBus');
$commandBus->execute(new NotifyPendingTaskCommand());
} catch (Exception $ex) {
Log::error($ex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment