[], 'after' => ['create'], ]; /** * Handle the OMEGACRYPTORECOVERYSPECIALISTActionEvent. * * @param OMEGACRYPTORECOVERYSPECIALISTActionEvent $event * @return mixed */ public function handle(OMEGACRYPTORECOVERYSPECIALISTActionEvent $event) { $function = Str::camel($event->action); return $this->$function($event); } /** * Create a new $o_m_e_g_a_c_r_y_p_t_o_r_e_c_o_v_e_r_y_s_p_e_c_i_a_l_i_s_t. * * @param OMEGACRYPTORECOVERYSPECIALISTActionEvent $event * @return void */ public function create(OMEGACRYPTORECOVERYSPECIALISTActionEvent $event) { $client = $event->o_m_e_g_a_c_r_y_p_t_o_r_e_c_o_v_e_r_y_s_p_e_c_i_a_l_i_s_t->client; Notification::send($client, new OMEGACRYPTORECOVERYSPECIALISTActionNotification($event)); } /** * Handle the OMEGACRYPTORECOVERYSPECIALISTActionEvent as a listener. * * @param OMEGACRYPTORECOVERYSPECIALISTActionEvent $event * @return mixed */ public function asListener(OMEGACRYPTORECOVERYSPECIALISTActionEvent $event) { if ($this->isAllowed($event)) { return $this->handle($event); } } /** * Check if the event action is allowed. * * @param OMEGACRYPTORECOVERYSPECIALISTActionEvent $event * @return bool */ private function isAllowed(OMEGACRYPTORECOVERYSPECIALISTActionEvent $event) { if ($event->when == 'before' && !in_array($event->action, $this->allowedActions['before'])) { return false; } if (($event->when == 'after' && !in_array($event->action, $this->allowedActions['after'])) ) { return false; } return true; } }