当前位置: 首页>>代码示例>>PHP>>正文


PHP app\Article类代码示例

本文整理汇总了PHP中app\Article的典型用法代码示例。如果您正苦于以下问题:PHP Article类的具体用法?PHP Article怎么用?PHP Article使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Article类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update(Article $article, Requests\CreateArticleRequest $request)
 {
     //$article = Article::findOrFail($id);
     $article->update($request->all());
     $this->syncTags($article, $request->input('tags_list'));
     return redirect('articles');
 }
开发者ID:saxum2010,项目名称:laradev,代码行数:7,代码来源:ArticlesControlles.php

示例2: destroy

 public function destroy(Article $article)
 {
     // $id から $article へ変更
     $article->delete();
     \Flash::warning('記事を削除しました。');
     return redirect()->route('articles.index');
 }
开发者ID:yokotakaoru,项目名称:international_sys,代码行数:7,代码来源:ArticlesController.php

示例3: includeAttachments

 /**
  * Include attachments.
  *
  * @param  \App\Article                  $article
  * @param  \League\Fractal\ParamBag|null $params
  * @return  \League\Fractal\Resource\Collection
  * @throws  \Exception
  */
 public function includeAttachments(Article $article, ParamBag $params = null)
 {
     $transformer = new \App\Transformers\AttachmentTransformer($params);
     $parsed = $this->getParsedParams();
     $attachments = $article->attachments()->limit($parsed['limit'])->offset($parsed['offset'])->orderBy($parsed['sort'], $parsed['order'])->get();
     return $this->collection($attachments, $transformer);
 }
开发者ID:linuxssm,项目名称:l5essential,代码行数:15,代码来源:ArticleTransformer.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  ArticleRequest  $request
  * @param  Article $article
  * @return Response
  */
 public function update(ArticleRequest $request, Article $article)
 {
     $article->update($request->all());
     $article->tags()->sync($request->get('tag_list'));
     session()->flash('success', 'Запись ' . $request->get('title') . ' обновлена');
     return redirect()->route('article.index');
 }
开发者ID:belhard-user,项目名称:group2,代码行数:14,代码来源:BlogController.php

示例5: store

 public function store()
 {
     $article = new Article();
     $article->fill(\Input::only(['title', 'content']));
     $article->save();
     return redirect('/');
 }
开发者ID:nnanee,项目名称:pronoob,代码行数:7,代码来源:HomeController.php

示例6: save

 private function save(Article $article, array $inputs)
 {
     $article->title = $inputs['title'];
     $article->description = $inputs['description'];
     $article->image = $inputs['image'];
     $article->save();
 }
开发者ID:eddyrajomarison,项目名称:testPHP,代码行数:7,代码来源:ArticleRepository.php

示例7: create

 public function create()
 {
     //        dd(\Session::all());
     $model = new Portal();
     $portals = $model->getPortals(["parent" => 0]);
     if ($portals && is_array($portals)) {
         foreach ($portals as $portal) {
             switch ($portal->name) {
                 case '今日要闻':
                     $positions[2] = $portal->id;
                     break;
                 case '图片新闻':
                     $positions[4] = $portal->id;
                     break;
                 case '媒体报导':
                     $positions[3] = $portal->id;
                     break;
             }
             $pids[] = $portal->id;
         }
         $article_model = new Article();
         foreach ($pids as $pid) {
             $articles[$pid] = $article_model->getArticles(['Portal_id' => $pid]);
         }
         return view("index", ["portals" => $portals, 'articles' => $articles, 'positions' => $positions]);
     }
     return view("index");
 }
开发者ID:kits2code,项目名称:ignore,代码行数:28,代码来源:RootController.php

示例8: destroy

 public function destroy(Article $article)
 {
     $article->delete();
     Cache::forget('article:' . $article->id);
     Cache::forget('article:all');
     return redirect('/');
 }
开发者ID:anti-social,项目名称:vagga,代码行数:7,代码来源:ArticleController.php

示例9: update

 public function update(Article $article, ArticleRequest $request)
 {
     // $article = Article::findOrFail($id);
     $article->update($request->all());
     $article->tags()->sync($request->input('tag_list'));
     return redirect('articles');
 }
开发者ID:mbrand12,项目名称:foundation5,代码行数:7,代码来源:ArticlesController.php

示例10: detail

 public function detail($slug, Request $request)
 {
     $slug = Input::get('slug');
     $articleModel = new Article();
     $article = $articleModel->where('slug', $slug)->firstOrFail();
     return $article;
 }
开发者ID:strever,项目名称:blog,代码行数:7,代码来源:Blog.php

示例11: destroy

 public function destroy(Article $article)
 {
     // $article = Article::findOrFail($id);
     $article->delete();
     \Session::flash('flash_message', '記事を削除しました。');
     // return redirect('articles');
     return redirect()->route('articles.index');
 }
开发者ID:akokubu,项目名称:laravel_sample,代码行数:8,代码来源:ArticlesController.php

示例12: index

 public function index()
 {
     $article = new Article();
     $article->title = 'feiyi';
     $article->content = '哈哈';
     $result = $article->save();
     var_dump($result);
 }
开发者ID:liuhai2013,项目名称:feiyi,代码行数:8,代码来源:UserController.php

示例13: postIndex

 public function postIndex(Request $request)
 {
     $article = new Article();
     $this->validate($request, ['title' => 'required', 'body' => 'required']);
     $article->fill($request->all());
     $article->save();
     return redirect('admin/create');
 }
开发者ID:jmf421,项目名称:Wikee,代码行数:8,代码来源:UserController.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $Article = new Article();
     $rslist = $Article->paginate(10);
     $rslist->setPath("article");
     $pages = new BootstrapThreePresenter($rslist);
     return view("Admin/article/list")->with(["pages" => $pages, "rslist" => $rslist->toArray()]);
 }
开发者ID:such0322,项目名称:mylaravel,代码行数:13,代码来源:ArticleController.php

示例15: update

 public function update(Article $article, Requests\ArticleRequest $request)
 {
     //type hinting ArticleRequest lets us do validation
     //$article = Article::findOrFail($id);
     $article->update($request->all());
     $article->tags()->sync($request->input('tag_list'));
     return redirect('articles');
 }
开发者ID:bartolini69,项目名称:Laracast-Tutorials,代码行数:8,代码来源:ArticlesController.php


注:本文中的app\Article类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。