/**
  * Controller constructor.
  * @param $module
  * @param $entity
  */
 public function __construct($module, $entity)
 {
     $this->module = Parse::camelize($module, true);
     $this->entity = Parse::camelize($entity, true);
     $path = Path::name($this->module, $this->entity);
     $this->model = new $path();
 }
示例#2
0
 /**
  *
  * @param type $module
  * @param type $entity
  */
 public function setScaffold($module, $entity)
 {
     $config = Parse::scaffold($module, $entity);
     foreach ($config as $prop => $value) {
         $this->{$prop} = $value;
     }
 }
示例#3
0
 /**
  * Resolve app requests
  *
  * @param null $index
  * @param null $id
  * @param null $language
  * @param null $parameters
  * @return mixed
  */
 public function resolve($index = null, $id = null, $language = null, $parameters = [])
 {
     if (is_null($index)) {
         $index = 'index';
     }
     $this->operation = Parse::operation($this->module, $this->entity, $index, $language);
     $this->parameters = $parameters;
     $this->parameters['id'] = $id;
     $this->data = ['operation' => $this->operation, 'language' => $language];
     $this->errors = [];
     return $this->{$index}($id);
 }