Mpociot\CaptainHook\Commands\AddWebhook::handle PHP Method

handle() public method

Execute the console command.
public handle ( ) : mixed
return mixed
    public function handle()
    {
        $hook = new Webhook();
        $hook->url = $this->argument('url');
        $hook->event = $this->argument('event');
        try {
            $hook->save();
            $this->info('The webhook was saved successfully.');
            $this->info('Event: ' . $hook->event);
            $this->info('URL: ' . $hook->url);
        } catch (Exception $e) {
            $this->error("The webhook couldn't be added to the database " . $e->getMessage());
        }
    }
AddWebhook