/** * Call the configured handlers. * @author Curtis Blackwell * @param string $service The snake_cased service name. * @param mixed $event The data from the service. * @return void */ private function handlerCaller($service, $event) { $handler = Str::camel($service) . 'Handler'; $addons = $this->getConfig('handlers:' . $service, []); $success = []; foreach ($addons as $addon) { $success[] = $this->api(str_replace(' ', '', $addon))->{$handler}($event); } if (in_array(false, $success)) { // NOTE The addon should log an error if it fails to perform a task. // Inform the service an addon failed to handle the event properly. http_response_code(500); exit; } // Inform the service that everything went smoovely. http_response_code(200); exit; }
private function createTerm($taxonomy, $slug) { $tag = Term::create($slug)->taxonomy($taxonomy)->with(['title' => Str::title($slug), 'id' => Helper::makeUuid()])->get(); $tag->save(); return $tag; }