Exemplo n.º 1
0
 /**
  * display
  *
  * @param \Illuminate\Database\Eloquent\Model $model
  *
  * @return mixed Value.
  *
  * @throws \Just\Shapeshifter\Exceptions\ShapeShifterException
  */
 public function compile(Model $model = null)
 {
     if ($this->fromcontroller->getMode() !== 'edit') {
         return;
     }
     $routes = Route::getRoutes();
     $controller = $this->resolveControllerByName($routes);
     $node = explode('.', $this->destination, -1);
     $path = explode('/', Request::path(), -1);
     $numerics = array_filter($path, 'is_numeric');
     $path = array_filter($path, function ($val) {
         return !is_numeric($val);
     });
     return View::make('shapeshifter::relations.OneToManyRelation', ['route' => $this->getDestinationRoute($path, $node, $numerics), 'title' => str_replace('_', ' ', $controller->getTitle()), 'function' => $this->function])->render();
 }
Exemplo n.º 2
0
 /**
  * @param $ref
  */
 protected function checkEventActions(AdminController $ref)
 {
     if (null === $ref->getParent()) {
         $this->model = !$this->model->id ? $ref->beforeAdd($this->model) : $ref->beforeUpdate($this->model);
     } else {
         $ref->getMode() === 'store' ? $ref->beforeAdd($this->model) : $ref->beforeUpdate($this->model);
     }
 }