/** * {@inheritdoc} */ protected function delete(Request $request) { $id = $request->get('id'); $actor = $request->actor; $input = $request->all(); $this->bus->dispatch(new DeleteDiscussion($id, $actor, $input)); }
public function handle(Request $request) { $userChannel = 'private-user' . $request->actor->id; if ($request->get('channel_name') === $userChannel) { $pusher = new Pusher($this->settings->get('pusher.app_key'), $this->settings->get('pusher.app_secret'), $this->settings->get('pusher.app_id')); $payload = json_decode($pusher->socket_auth($userChannel, $request->get('socket_id')), true); return new JsonResponse($payload); } return new EmptyResponse(403); }
/** * {@inheritdoc} */ public function handle(Request $request, array $routeParams = []) { if (!$request->actor->isAdmin()) { throw new PermissionDeniedException(); } $permission = $request->get('permission'); $groupIds = $request->get('groupIds'); Permission::where('permission', $permission)->delete(); Permission::insert(array_map(function ($groupId) use($permission) { return ['permission' => $permission, 'group_id' => $groupId]; }, $groupIds)); return new EmptyResponse(204); }
protected function delete(Request $request) { if (!$request->actor->isAdmin()) { throw new PermissionDeniedException(); } $name = $request->get('name'); $this->extensions->disable($name); $this->extensions->uninstall($name); app('flarum.formatter')->flush(); $forum = app('Flarum\\Forum\\Actions\\ClientAction'); $forum->flushAssets(); $admin = app('Flarum\\Admin\\Actions\\ClientAction'); $admin->flushAssets(); }
/** * Log in and return a token. * * @param Request $request * @return \Psr\Http\Message\ResponseInterface * @throws PermissionDeniedException */ public function handle(Request $request) { $identification = $request->get('identification'); $password = $request->get('password'); $user = $this->users->findByIdentification($identification); if (!$user || !$user->checkPassword($password)) { throw new PermissionDeniedException(); } if (!$user->is_activated) { event(new UserEmailChangeWasRequested($user, $user->email)); return new JsonResponse(['code' => 'confirm_email', 'email' => $user->email], 401); } $token = $this->bus->dispatch(new GenerateAccessToken($user->id)); return new JsonResponse(['token' => $token->id, 'userId' => $user->id]); }
public function handle(Request $request) { if (!$request->actor->isAdmin()) { throw new PermissionDeniedException(); } $order = $request->get('order'); Tag::query()->update(['position' => null, 'parent_id' => null]); foreach ($order as $i => $parent) { $parentId = array_get($parent, 'id'); Tag::where('id', $parentId)->update(['position' => $i]); if (isset($parent['children']) && is_array($parent['children'])) { foreach ($parent['children'] as $j => $childId) { Tag::where('id', $childId)->update(['position' => $j, 'parent_id' => $parentId]); } } } return new EmptyResponse(204); }
public function handle(Request $request) { if (!$request->actor->isAdmin()) { throw new PermissionDeniedException(); } $enabled = $request->get('enabled'); $name = $request->get('name'); if ($enabled === true) { $this->extensions->enable($name); } elseif ($enabled === false) { $this->extensions->disable($name); } app('flarum.formatter')->flush(); $forum = app('Flarum\\Forum\\Actions\\ClientAction'); $forum->flushAssets(); $admin = app('Flarum\\Admin\\Actions\\ClientAction'); $admin->flushAssets(); }
/** * {@inheritdoc} */ public function handle(Request $request, array $routeParams = []) { if (!$request->actor->isAdmin()) { throw new PermissionDeniedException(); } $config = $request->get('config', []); // TODO: throw HTTP status 400 or 422 if (!is_array($config)) { throw new Exception(); } foreach ($config as $k => $v) { $this->settings->set($k, $v); if (strpos($k, 'theme_') === 0 || $k === 'custom_less') { $forum = app('Flarum\\Forum\\Actions\\ClientAction'); $forum->flushAssets(); $admin = app('Flarum\\Admin\\Actions\\ClientAction'); $admin->flushAssets(); } } return new EmptyResponse(204); }
/** * Log in and return a token. * * @param \Flarum\Api\Request $request * @return \Psr\Http\Message\ResponseInterface */ public function handle(Request $request) { $email = $request->get('email'); $this->bus->dispatch(new RequestPasswordReset($email)); return new EmptyResponse(); }
/** * Delete a discussion. * * @param \Flarum\Api\Request $request * @param \Illuminate\Http\Response $response * @return void */ protected function delete(Request $request, Response $response) { $this->bus->dispatch(new DeleteDiscussionCommand($request->get('id'), $request->actor->getUser())); }
/** * Delete a tag. * * @param Request $request */ protected function delete(Request $request) { $this->bus->dispatch(new DeleteTag($request->get('id'), $request->actor)); }
/** * Delete reports for a post. * * @param Request $request */ protected function delete(Request $request) { $this->bus->dispatch(new DeleteReports($request->get('id'), $request->actor, $request->all())); }
/** * Log in and return a token. * * @param \Flarum\Api\Request $request * @return \Flarum\Api\Response */ public function respond(Request $request) { $email = $request->get('email'); $this->bus->dispatch(new RequestPasswordResetCommand($email)); return new Response(); }