/** * Prepares the response before sending to the browser. * * @return Laravel\Response */ public function prepare() { $collection = new Collection(null); $asset = $this->getAssetFromUri(URI::current()); if (!($asset = $collection->add($asset))) { return; } // Create a new LaravelResponse object with the contents of the asset. Once we have the // response object we can adjust the headers before sending it to the browser. $this->response = new LaravelResponse($collection->compile($asset->getGroup())); switch ($asset->getGroup()) { case 'style': $this->response->header('content-type', 'text/css'); break; case 'script': $this->response->header('content-type', 'application/javascript'); break; } return $this; }