public function store(EventRequest $request, $resourceId)
    {
        $eventable = $this->getEventableRepository()->model()->findOrFail($resourceId);

        $event = $this->event->create($request);

        if ($event && method_exists($eventable, 'events')) {
            $eventable->events()->attach($event->id);

            $message = 'Successfully created event.';

            return redirect()->route($this->routes['index'], $eventable->id)->withSuccess($message);
        } else {
            $message = 'There was an issue creating an event. Please try again.';

            return redirect()->route($this->routes['create'])->withErrors($message);
        }
    }
public function store(EventRequest $request, $resourceId)
    {
        $eventable = $this->getEventableRepository()->model()->findOrFail($resourceId);

        $event = $this->event->create($request);

        if ($event && method_exists($eventable, 'events')) {
            $eventable->events()->attach($event->id);

            $message = 'Successfully created event.';

            return redirect()->route($this->routes['index'], $eventable->id)->withSuccess($message);
        } else {
            $message = 'There was an issue creating an event. Please try again.';

            return redirect()->route($this->routes['create'])->withErrors($message);
        }
    }
public function store ( EventRequest $ request , $ resourceId ) { $ eventable = $ this -> getEventableRepository ( ) -> model ( ) -> findOrFail ( $ resourceId ) ; $ event = $ this -> event -> create ( $ request ) ; if ( $ event && method_exists ( $ eventable , 'events' ) ) { $ eventable -> events ( ) -> attach ( $ event -> id ) ; $ message = 'Successfully created event.' ; return redirect ( ) -> route ( $ this -> routes [ 'index' ] , $ eventable -> id ) -> withSuccess ( $ message ) ; } else { $ message = 'There was an issue creating an event. Please try again.' ; return redirect ( ) -> route ( $ this -> routes [ 'create' ] ) -> withErrors ( $ message ) ; } }
Creates a new event and attaches it to the specified eventable.

@param EventRequest $request
@param int|string   $resourceId

@return \Illuminate\Http\RedirectResponse
Creates a new event and attaches it to the specified eventable .