Пример #1
0
 /**
  * Display a list of all of the feeder's article.
  *
  * @param  Request  $request
  * @return Response
  */
 public function forFeeder(Request $request, Feeder $feeder)
 {
     $ret = array();
     $features = array();
     $ret["type"] = "FeatureCollection";
     foreach ($this->articles->forFeeder($feeder) as $article) {
         $features[] = array("type" => "Feature", "geometry" => array("type" => "Point", "coordinates" => array_map('floatval', explode(",", $article->location))), "properties" => array("name" => $article->title));
     }
     $ret["features"] = $features;
     return response()->json($ret);
 }
Пример #2
0
 public function edit(int $id)
 {
     $parentMenuItems = ArticleRepository::getTopLevel()->filter(function (Article $article) {
         return $article->technical_name != SpecialArticle::HOME;
     })->pluck('name', 'id')->prepend('Geen', 0);
     return parent::edit($id)->with(compact('parentMenuItems'));
 }
Пример #3
0
 public function index(...$articleSlugs)
 {
     $articleSlug = collect($articleSlugs)->last();
     $article = ArticleRepository::findBySlug($articleSlug);
     if ($article->hasChildren()) {
         return redirect($article->firstChild->fullUrl);
     }
     return view('front.article.index')->with(compact('article'));
 }
Пример #4
0
 /**
  * 删除
  *
  * @param ineger $id
  */
 public function getDestroy($id)
 {
     $this->articleRepository->destroy($id);
     return responseSuccess('删除成功');
 }
Пример #5
0
 /**
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $article = $this->articleRepository->findByTechnicalNameOrAbort($this->getTechnicalName());
     return view("front.{$this->getViewFolderName()}.index")->with(compact('article'));
 }
Пример #6
0
 /**
  * 根据文章类型
  * @param $type
  * @return \Illuminate\view\view
  */
 public function getArticles($type)
 {
     $articles = $this->articleRepository->getArticlesByType($type, $this->pageSize);
     //var_dump($articles->toArray());exit;
     return view('post.index', compact('articles'));
 }
Пример #7
0
 /**
  * @param \App\Repositories\ArticleRepository $articleRepository
  *
  * @return \Illuminate\Http\Response
  */
 public function index(ArticleRepository $articleRepository)
 {
     $article = $articleRepository->findByTechnicalName('contact');
     $data = compact('article');
     return view('front.contact.index', $data);
 }
 public function testCreatePost()
 {
     $latestId = self::ARTICLE_COUNT + 1;
     $article = $this->repository->create(['title' => 'title ' . $latestId, 'body' => 'body ' . $latestId]);
     $this->assertEquals(self::ARTICLE_COUNT + 1, $article->id);
 }