/**
  * Store a newly created Element in storage.
  *
  * @param CreateElementRequest $request
  *
  * @return Response
  */
 public function store(CreateElementRequest $request)
 {
     $input = $request->all();
     $element = $this->elementRepository->create($input);
     Flash::success('Element saved successfully.');
     return redirect(route('elements.index'));
 }
 /**
  * Store a newly created Element in storage.
  * POST /elements
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(Request $request)
 {
     if (sizeof(Element::$rules) > 0) {
         $this->validateRequestOrFail($request, Element::$rules);
     }
     $input = $request->all();
     $elements = $this->elementRepository->create($input);
     header("Access-Control-Allow-Origin:" . $this->clientURL);
     return $this->sendResponse($elements, "Element saved successfully");
 }