Ejemplo n.º 1
1
 /**
  * @param View $view
  */
 public function compose(View $view)
 {
     $view->cruddyData = $this->cruddy->data();
     $view->cruddyData += ['schemaUrl' => $this->url->route('cruddy.schema'), 'thumbUrl' => $this->url->route('cruddy.thumb'), 'baseUrl' => $this->url->route('cruddy.home'), 'root' => $this->request->root(), 'token' => csrf_token()];
     $view->scripts = $this->assets->scripts();
     $view->styles = $this->assets->styles();
     $view->menu = $this->menuBuilder;
 }
Ejemplo n.º 2
0
 /**
  * @param array $options
  *
  * @return string
  */
 protected function getLabel(array $options)
 {
     $label = parent::getLabel($options);
     if (!$label and isset($options['entity'])) {
         $label = $this->env->entity($options['entity'])->getPluralTitle();
     }
     return $label;
 }
Ejemplo n.º 3
0
 /**
  * Resolve an entity.
  *
  * @param string $id
  * @param string $action
  *
  * @return \Kalnoy\Cruddy\Entity
  */
 protected function resolve($id, $action)
 {
     $entity = $this->environment->entity($id);
     if (!$entity->isPermitted($action)) {
         $message = trans("cruddy::app.forbidden.{$action}", ['entity' => $id]);
         throw new AccessDeniedException($message);
     }
     return $entity;
 }