當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。