Example #1
0
 /**
  * @param $template
  *
  * @return string
  */
 public function render_controller($template)
 {
     $this->controllerReplacements[':app_namespace'] = $this->getAppNamespace();
     $this->controllerReplacements[':resource'] = $this->identifier;
     $this->controllerReplacements[':model_name'] = $this->command->model_name($this->identifier);
     $this->controllerReplacements[':request_name'] = $this->command->request_name($this->identifier);
     $this->controllerReplacements[':controller_name'] = $this->command->controller_name($this->identifier);
     $this->controllerReplacements[':identifier'] = $this->identifier;
     $routeName = empty($this->routeNames) ? $this->identifier : 'admin.' . $this->identifier;
     if ($this->options['create']) {
         $this->controllerReplacements[':create_route'] = '$this->viewData' . "['createRoute'] = '" . $routeName . ".create';";
     }
     if ($this->options['edit']) {
         $this->controllerReplacements[':edit_route'] = '$this->viewData' . "['editRoute'] = '" . $routeName . ".edit';";
     }
     if ($this->options['destroy']) {
         $this->controllerReplacements[':destroy_route'] = '$this->viewData' . "['deleteRoute'] = '" . $routeName . ".destroy';";
     }
     $template = strtr($template, $this->controllerReplacements);
     return $template;
 }