BlockSuggestion::class, 'interactive_message' => InteractiveMessage::class, ]; /** * Returns new event instance * * @param string $type * @param array $request * @return Base */ public static function create(string $type,array $request) { $class = Arr::get(config('slack.options',self::map),$type,Unknown::class); Log::debug(sprintf('%s:Working out Interactive Options Event Class for [%s] as [%s]',static::LOGKEY,$type,$class),['m'=>__METHOD__]); if (App::environment() == 'dev') file_put_contents('/tmp/option.'.$type,print_r(json_decode($request->input('payload')),TRUE)); return new $class($request); } public static function make(Payload $request): Base { // During the life of the event, this method is called twice - once during Middleware processing, and finally by the Controller. static $o = NULL; static $or = NULL; if (! $o OR ($or != $request)) { $or = $request; $o = self::create(Arr::get($request->getData(),'payload.type'),Arr::get($request->getData(),'payload')); } return $o; } }