예제 #1
0
 public static function boot()
 {
     parent::boot();
     Webhook::creating(function ($results) {
         Cache::forget('webhooks');
     });
 }
 public function fire()
 {
     $this->url = $this->argument('url');
     $this->event = $this->argument('event');
     try {
         Webhook::create(['id' => $this->getUuid(), 'callback_url' => $this->url, 'event' => $this->event]);
         $this->info(sprintf("Webhook added to system for %s and event %s with id %s", $this->url, $this->event, $this->getUuid()));
     } catch (\Exception $e) {
         $this->error(sprintf("Error adding webhook to database %s", $e->getMessage()));
     }
 }
 public function fire()
 {
     $this->uuid = $this->argument('uuid');
     if ($this->uuid == false) {
         $all = Webhook::select('id', 'callback_url', 'event')->get();
         $this->table(['id', 'url', 'event'], $all->toArray());
         $this->info("Choose a uuid and use it for delete command");
     } else {
         if ($result = Webhook::where('id', $this->uuid)->first()) {
             $result->delete();
             $this->info(sprintf("Deleted uuid %s", $this->uuid));
         } else {
             $this->info(sprintf("Uuid %s not found :( try just delete with no uuid", $this->uuid));
         }
     }
 }