Ejemplo n.º 1
0
 /**
  * Bulk edit of states and roles
  *
  * @return View
  */
 public function getRoleStates()
 {
     $states = $this->stateRepo->getAllWithRoles();
     $roles = $this->roleRepo->getAll();
     $stateRoles = [];
     foreach ($states as $state) {
         $stateRoles[$state->id] = $state->roles->lists('name', 'id');
     }
     return $this->view('salgado.pages.state.role_state', compact('states', 'roles', 'stateRoles'));
 }
 public function edit($id)
 {
     $user = $this->auth->user();
     try {
         $article = $this->artcl->findById($id);
         if ($this->control->canByPass()) {
             $categories = $this->catRepo->getAll();
             $states = $this->stateRepo->getAll();
         } else {
             $categories = $this->catRepo->loadUserAvailableCats($user);
             $states = $this->stateRepo->loadUserAvailableStates($user);
         }
     } catch (NotFoundException $e) {
     }
 }
Ejemplo n.º 3
0
 /**
  * @param $stateId
  * @return bool
  */
 public function userHasAccessToState($stateId)
 {
     $userRoles = $this->roleRepo->getUserRoles($this->getUser())->lists('id');
     $rolesStates = $this->stateRepo->getStatesOfRoles($userRoles)->lists('id');
     return in_array($stateId, $rolesStates);
 }
 /**
  * Create a new article state
  *
  * @param $command
  * @return State
  */
 public function handle($command)
 {
     $this->setCommand($command);
     return $this->stateRepo->createRaw($this->getCommandData());
 }
 /**
  * Add requested state to article
  *
  * @return void
  */
 protected function addState()
 {
     $this->created = $this->stateRepo->addStateToArticle($this->created, $this->command->state_id, true, $this->command->user_id);
 }
 public function doUpdate()
 {
     $commandData = $this->getCommand();
     $updateable = $this->stateRepo->findById($commandData->id);
     return $this->stateRepo->update($updateable, $this->getUpdateData());
 }