/** * Set layout title and load resource view. * * @param string $view * @param array $labels * * @return Response */ protected function loadView($view, array $labels = null) { // Add data to the view $view = view('resource.' . $view)->with(['resource' => $this->resource, 'labels' => $labels ? (object) $labels : (object) $this->resource->getLabels()]); // Add data to the layout $this->layout->title = $this->resource->singular(); // Return layout + view return $this->layout($view); }