/** * @return string */ protected function composeJsPipeline() { $output = ''; $jwtoken = $this->getJWT(); $this->setJWT($jwtoken); $this->provideAPIRoutes(); $output .= $this->setVueResourceHeader($jwtoken); foreach ($this->javascriptPipeline->allJs() as $js) { $output .= $js; } return $output; }
/** * Bind the given array of variables to the view. */ public function put() { $arguments = func_get_args(); if (is_array($arguments[0])) { $variables = $arguments[0]; } elseif (count($arguments) == 2) { $variables = [$arguments[0] => $arguments[1]]; } else { throw new Exception('Try JavaScript::put(["foo" => "bar"]'); } // First, we have to translate the variables // to something JS-friendly. $js = $this->buildJavaScriptSyntax($variables); // And then we'll actually bind those // variables to the view. $this->javascriptPipeline->addJs($js); return $js; }