/** * 멘션 suggestion 리스트 * * @param Request $request * @return mixed */ public function mention(Request $request) { $suggestions = []; $string = $request->get('string'); $users = User::where('displayName', 'like', $string . '%')->where('id', '<>', Auth::user()->getId())->get(); foreach ($users as $user) { $suggestions[] = ['id' => $user->getId(), 'displayName' => $user->getDisplayName(), 'profileImage' => $user->profileImage]; } return XePresenter::makeApi($suggestions); }
private function setProfileImageResolverOfUser() { $default = $this->app['config']['xe.user.profileImage.default']; $storage = $this->app['xe.storage']; $media = $this->app['xe.media']; User::setProfileImageResolver(function ($imageId) use($default, $storage, $media) { try { if ($imageId !== null) { /** @var Storage $storage */ $file = File::find($imageId); if ($file !== null) { /** @var MediaManager $media */ $mediaFile = $media->make($file); return asset($mediaFile->url()); } } } catch (\Exception $e) { } return asset($default); }); }
/** * move to copy * * @return \Illuminate\Http\RedirectResponse|Redirect */ public function copy(Request $request) { $documentIds = $request->get('id'); $documentIds = is_array($documentIds) ? $documentIds : [$documentIds]; $instanceId = $request->get('instanceId'); $config = $this->configHandler->get($instanceId); if ($config === null) { throw new NotFoundConfigHttpException(['instanceId' => $instanceId]); } $items = Board::find($documentIds); foreach ($items as $item) { $this->handler->setModelConfig($item, $this->configHandler->get($item->instanceId)); $user = new Guest(); if ($item->userId != '') { $user = User::find($item->userId); } $this->handler->copy($item, $user, $config); } Session::flash('alert', ['type' => 'success', 'message' => xe_trans('xe::processed')]); return $this->presenter->makeApi([]); }