コード例 #1
0
 /**
  * Show info about a work-group.
  *
  * @param Industry  $industry
  * @param Workgroup $workGroup
  *
  * @return \Illuminate\Http\Response
  */
 public function showWorkGroup(Industry $industry, Workgroup $workGroup)
 {
     $articles = $this->articleRepository->mostViewedByIndustry($industry, 3)->get();
     $events = $this->industryRepository->companyEvents($industry)->get();
     $decisions = $this->industryRepository->companyDecisions($industry)->get();
     $members = $this->userRepository->whereCompaniesIndustry($industry)->get();
     return view('ahk.industries.work_groups.show', compact('industry', 'workGroup', 'articles', 'events', 'decisions', 'members'));
 }
コード例 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param UpdateArticleRequest $request
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function update($id, UpdateArticleRequest $request)
 {
     $article = $this->articleRepository->getById($id);
     if ($article === null) {
         Flash::error('cms.article_does_not_exists');
         return redirect()->back();
     }
     $category = $this->categoryRepository->getById($request->get('category_id'));
     $articleUpdated = $this->articleRepository->updateById($id, $request->only(['title', 'description', 'publish', 'source', 'content', 'img_url']), $category);
     if (!$articleUpdated) {
         Flash::error(trans('cms.unable_to_update_article'));
         return redirect()->back();
     }
     Flash::success(trans('cms.article_updated'));
     $tagsUpdated = $this->articleRepository->updateTagsById($articleUpdated->id, $request->get('tagIds', []));
     if (!$tagsUpdated) {
         Flash::error(trans('cms.unable_to_update_tags'));
     }
     return redirect()->route('cms.articles.edit', $articleUpdated);
 }
コード例 #3
0
ファイル: HealthController.php プロジェクト: ahk-ch/chamb.net
 /**
  * Display a listing of the news resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function news()
 {
     $articles = $this->articleRepository->published()->paginate(6);
     return view('ahk.health.news', compact('articles'));
 }