/** * Handle the command. * * @param $command */ public function handle($command) { $role = Role::create(['default' => $command->default]); $this->roleRepository->save($role); $this->translationService->sync($role, $command->translated); $this->permissionsService->sync($role, $command->permissions); $this->eventDispatcher->dispatch($role->releaseEvents()); }
/** * Setup the required filters necessary for executing a role search request, based on the $input provided. * * @param $input * @return mixed */ public function fromInput(array $input = []) { $filterCollection = new SearchFilterCollection(); if (isset($input['keywords'])) { $filterCollection->add(KeywordFilter::fromKeywords($input['keywords'])); } $filterCollection->add(OrderFilter::byInput($input)); $roles = $this->roleRepository->getByFilters($filterCollection); return $roles; }
/** * Retrieve a single role. * * @Get("roles/{slug}", middleware={"shift.account", "shift.auth"}, as="roles.show") * * @param $slug * @return mixed */ public function getShow($slug) { $role = Translator::translate($this->roleRepository->requireBySlug($slug)); return $this->respond('shift::roles.edit', compact('role')); }
/** * Setup the guest role for the account. * * @param Account $account */ private function setupGuest(Account $account) { $guest = Role::create([]); $guest->setAccount($account); $this->roleRepository->save($guest); }