Exemplo n.º 1
0
 /**
  * @param AdminController $fromController
  * @param string          $destination
  * @param string          $function
  * @param array           $flags
  */
 public function __construct(AdminController $fromController, $destination, $function, $flags = [])
 {
     $this->destination = 'admin.' . $destination . '.index';
     $this->fromcontroller = $fromController;
     $this->model = $fromController->getRepo()->getModel();
     $this->function = $function;
     $this->name = $destination;
     $this->flags = $flags;
     $this->flags[] = 'hide_list';
 }
Exemplo n.º 2
0
 /**
  * @param AdminController $fromController
  * @param array           $destination
  * @param $function
  * @param array $flags
  *
  * @throws \Just\Shapeshifter\Exceptions\MethodNotExistException
  */
 public function __construct(AdminController $fromController, $destination, $function, $flags = [])
 {
     $this->destination = 'admin.' . $destination . '.index';
     $this->destination = $this->setupDestination();
     $this->fromcontroller = $fromController;
     $this->model = $fromController->getRepo()->getModel();
     $this->function = $function;
     $this->name = $destination;
     $this->flags = $flags;
     $this->foreign = $this->name = $this->getForeignField();
 }
 /**
  * @param AdminController $fromController
  * @param string          $destination
  * @param string          $function
  * @param array           $flags
  *
  * @throws ShapeShifterException
  */
 public function __construct(AdminController $fromController, $destination, $function, $flags = [])
 {
     $routes = Route::getRoutes();
     $this->destination = 'admin.' . $destination . '.index';
     $this->destination = $this->resolveControllerByName($routes);
     $this->fromcontroller = $fromController;
     if ($current = $this->getCurrentRecordId()) {
         $repo = $fromController->getRepo();
         $this->model = $repo->findById($current);
         if (null == $this->model) {
             throw new ShapeShifterException(sprintf('Model [%s] with id [%s] doesn\'t exist', get_class($repo->getModel()), $current));
         }
     }
     $this->function = $function;
     $this->name = $this->destination->getTitle();
     $this->flags = array_merge($flags, ['hide_list']);
 }