Trigger a action for given article specified over get-action parameter.

@Post("/articles/{uuid}")

@param string  $uuid
@param Request $request

@return Response
195530
public function postTriggerAction($uuid, Request $request)
    {
        // extract parameter
        $action = $this->getRequestParameter($request, 'action', true);
        $locale = $this->getRequestParameter($request, 'locale', true);

        // prepare vars
        $view = null;
        $data = null;
        $userId = $this->getUser()->getId();

        try {
            switch ($action) {
                case 'unpublish':
                    $document = $this->getDocumentManager()->find($uuid, $locale);
                    $this->getDocumentManager()->unpublish($document, $locale);
                    $this->getDocumentManager()->flush();

                    $data = $this->getDocumentManager()->find($uuid, $locale);

                    break;
                case 'remove-draft':
                    $data = $this->getDocumentManager()->find($uuid, $locale);
                    $this->getDocumentManager()->removeDraft($data, $locale);
                    $this->getDocumentManager()->flush();

                    break;
                case 'copy-locale':
                    $destLocales = $this->getRequestParameter($request, 'dest', true);
                    $destLocales = explode(',', $destLocales);

                    $securityChecker = $this->get('sulu_security.security_checker');
                    foreach ($destLocales as $destLocale) {
                        $securityChecker->checkPermission(
                            new SecurityCondition($this->getSecurityContext(), $destLocale),
                            PermissionTypes::EDIT
                        );
                    }

                    $this->getMapper()->copyLanguage($uuid, $userId, null, $locale, $destLocales);

                    $data = $this->getDocumentManager()->find($uuid, $locale);

                    break;
                case 'copy':
                    /** @var ArticleDocument $document */
                    $document = $this->getDocumentManager()->find($uuid, $locale);
                    $copiedPath = $this->getDocumentManager()->copy($document, dirname($document->getPath()));
                    $this->getDocumentManager()->flush();

                    $data = $this->getDocumentManager()->find($copiedPath, $locale);

                    break;
                case 'order':
                    $this->orderPages($this->getRequestParameter($request, 'pages', true), $locale);
                    $this->getDocumentManager()->flush();
                    $this->getDocumentManager()->clear();

                    $data = $this->getDocumentManager()->find($uuid, $locale);

                    break;
                default:
                    throw new RestException('Unrecognized action: ' . $action);
            }

            // prepare view
            $view = $this->view($data);
            $view->setSerializationContext(
                SerializationContext::create()
                    ->setSerializeNull(true)
                    ->setGroups(['defaultPage', 'defaultArticle', 'smallArticlePage'])
            );
        } catch (RestException $exc) {
            $view = $this->view($exc->toArray(), 400);
        }

        return $this->handleView($view);
    }
905908
public function postAction($id, Request $request)
    {
        return $this->addMediaToEntity($this->getAccountEntityName(), $id, $request->get('mediaId', ''));
    }
408487
public function postTriggerAction($id, Request $request)
    {
        $view = null;
        $snippet = null;

        $locale = $this->getLocale($request);
        $action = $this->getRequestParameter($request, 'action', true);

        try {
            switch ($action) {
                case 'copy-locale':
                    $destLocales = explode(',', $this->getRequestParameter($request, 'dest', true));

                    // call repository method
                    $snippet = $this->snippetRepository->copyLocale(
                        $id,
                        $this->getUser()->getId(),
                        $locale,
                        $destLocales
                    );

                    // publish the snippet in every dest locale, otherwise it's not in the live workspace.
                    foreach ($destLocales as $destLocale) {
                        $destSnippet = $this->findDocument($id, $destLocale);
                        $this->documentManager->publish($destSnippet, $destLocale);
                    }

                    // flush all published snippets
                    $this->documentManager->flush();

                    break;
                default:
                    throw new RestException('Unrecognized action: ' . $action);
            }

            // prepare view
            $view = View::create(
                $this->decorateSnippet($snippet->toArray(), $locale),
                null !== $snippet ? 200 : 204
            );
        } catch (RestException $exc) {
            $view = View::create($exc->toArray(), 400);
        }

        return $this->viewHandler->handle($view);
    }
1000775
public function collectionAction($collection, Request $request = null)
    {
        $action = $this->container->get(CollectionPostArchiveAction::class);

        return $action($this->resolveRequest($request), $collection);
    }
1003065
public function postTriggerAction($id, Request $request)
    {
        $status = $request->get('action');
        $em = $this->getDoctrine()->getManager();

        try {
            $order = $this->getManager()->findByIdAndLocale(
                $id,
                $this->getLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'))
            );
            if (!$order) {
                throw new OrderNotFoundException($id);
            }

            switch ($status) {
                case 'confirm':
                    $this->getManager()->convertStatus($order, OrderStatus::STATUS_CONFIRMED);
                    break;
                case 'edit':
                    $this->getManager()->convertStatus($order, OrderStatus::STATUS_CREATED);
                    break;
                default:
                    throw new RestException("Unrecognized status: " . $status);
            }

            $em->flush();
            $view = $this->view($order, 200);
        } catch (OrderNotFoundException $exc) {
            $exception = new EntityNotFoundException($exc->getEntityName(), $exc->getId());
            $view = $this->view($exception->toArray(), 404);
        }

        return $this->handleView($view);
    }
276726
public function show(Request $request, $id)
    {
        $this->validate($request, [
            'id' => 'uuid'
        ]);

        try{
            $did = $request->user()->dids()->where('id', $id)->with(['tags', 'client'])->firstOrFail();
            $results = fractal()->item($did, new DidTransformer());
            return response()->json($results);
        }catch (\Exception $e){
            return response()->json([ 'error' => 404, 'message' => 'Not found' ], 404);
        }

    }
1125241
public function doAction(Request $request)
    {
        $token = $this->payum->getHttpRequestVerifier()->verify($request);

        $gateway = $this->payum->getGateway($token->getGatewayName());

        $gateway->execute(new Notify($token));

        return new Response('', 204);
    }
751504
public function reloadAction(Request $request)
	{
		$pageId      = $request->get( 'pageId' );
		$formFieldId = $request->get( 'formFieldId' );
		$uniqId      = $request->get( 'uniqId' );
		$code        = $request->get( 'code', 'networking_init_cms.admin.page' );
		$html   = $this->getLayoutBlockFormWidget( $pageId, $formFieldId, $uniqId, $code );
		$status = 200;

		return new Response( $html, $status );
	}
168491
public function cgetAction(Request $request): View
    {
        $this->requireAuthentication($request);

        return View::create()->setData($this->subscriberListRepository->findAll());
    }
1222421
public function postTriggerAction(Request $request, $uuid, $version)
    {
        $action = $this->getRequestParameter($request, 'action', true);
        $language = $this->getLocale($request);

        switch ($action) {
            case 'restore':
                $document = $this->getDocumentManager()->find($uuid, $language);
                $this->getDocumentManager()->restore(
                    $document,
                    $language,
                    str_replace('_', '.', $version)
                );
                $this->getDocumentManager()->flush();

                $data = $this->getDocumentManager()->find($uuid, $language);
                break;
        }

        $view = $this->view($data, null !== $data ? 200 : 204);

        $context = new Context();
        $context->setGroups(['defaultPage']);

        return $this->handleView($view->setContext($context));
    }
997012
public function article(HTTPRequest $request)
    {
        $params = $request->params();
        if ($params['ID']) {
            $article = Article::get()->filter(['HailID' => $params['ID']])->first();
            //Try to find the article with the database ID field, to be backward compatible with old Hail module (after upgrade)
            if(!isset($article) || empty($article)) {
                $article = Article::get()->filter(['ID' => $params['ID']])->first();
            }
        }

        if (!$params['ID'] || !isset($article) || empty($article)) {
            return $this->httpError(404, 'That article could not be found');
        }
        $data = [
            'Article' => $article,
            'Related' => null
        ];
        
        //Store the current article so we can use it in other functions in the controller
        $this->article = $article;

        //If Related Articles are enabled on the page (from the CMS)
        if ($this->owner->EnableRelated === "Yes") {
            //Try to find 3 related articles
            if ($article->PublicTags()->Count() > 0) {
                $related = Article::get()->filter(['PublicTags.ID' => $article->PublicTags()->map('ID', 'ID')->toArray()])->exclude(['HailID' => $params['ID']])->sort('Date DESC')->limit(3);
                if ($related->Count() > 0) {
                    $data['Related'] = $related;
                }
            }
        }

        return $data;
    }
528350
public function store(ArticlesFormRequest $request)
    {
        $article = new Article;
        $article->fill($request->all());
        $article->published     = $request->get('published', false);
        $article->featured      = $request->get('featured', false);
        $article->authenticated = $request->get('authenticated', false);
        $article->is_page       = $request->get('is_page', false);
        $article->save();

        $article->permissions()->sync($request->get('permissions', []));
        if ($request->tags) {
            $article->tag(explode(',', $request->tags));
        }

        event(new ArticleWasCreated($article));

        flash()->success(trans('cms::article.store.success'));

        return redirect()->route('administrator.articles.index');
    }
659379
public function get($parentUuid, $uuid)
    {
        // Check parent exists
        $parentModel = static::$parentModel;
        $parentResource = $parentModel::findOrFail($parentUuid);

        // Authorize ability to view children model for parent
        $this->authorizeUserAction($this->parentAbilitiesRequired['view'], $parentResource);

        // Get resource
        $model = new static::$model;
        $resource = $model::with($model::$localWith)->where($model->getKeyName(), '=', $uuid)->firstOrFail();

        // Check resource belongs to parent
        if ($resource->getAttribute(($parentResource->getKeyName())) != $parentResource->getKey()) {
            throw new AccessDeniedHttpException('Resource \'' . class_basename(static::$model) . '\' with given UUID ' . $uuid . ' does not belong to ' .
                'resource \'' . class_basename(static::$parentModel) . '\' with given UUID ' . $parentUuid . '; ');
        }

        if (! $resource) {
            throw new NotFoundHttpException('Resource \'' . class_basename(static::$model) . '\' with given UUID ' . $uuid . ' not found');
        }

        // Authorize ability to create this model
        $this->authorizeUserAction('view', $resource);

        return $this->response->item($resource, $this->getTransformer());
    }
320816
protected function processPost(Request $request)
    {
        $resource = $this->getResourceManager()->createNewInstance();
        return $this->processAction($request, 'POST', $resource);
    }
277869
public function deleteAction($articleUuid, $uuid, Request $request)
    {
        $locale = $this->getRequestParameter($request, 'locale', true);

        $documentManager = $this->getDocumentManager();
        $document = $documentManager->find($uuid, $locale);
        $documentManager->remove($document);
        $documentManager->flush();

        return $this->handleView($this->view(null));
    }
773756
public function cgetAction($id, Request $request)
    {
        $formatOptions = $this->getFormatOptionsManager()->getAll($id);

        return $this->handleView($this->view(count($formatOptions) > 0 ? $formatOptions : new \stdClass()));
    }
658429
public function postGenerateAction(Request $request)
    {
        $parentUuid = $this->getRequestParameter($request, 'parent');
        $parts = $this->getRequestParameter($request, 'parts', true);
        $templateKey = $this->getRequestParameter($request, 'template', true);
        $webspaceKey = $this->getRequestParameter($request, 'webspace', true);
        $languageCode = $this->getLocale($request);

        $result = $this->getResourceLocatorRepository()->generate(
            $parts,
            $parentUuid,
            $webspaceKey,
            $languageCode,
            $templateKey
        );

        return $this->handleView($this->view($result));
    }