當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Article::fill方法代碼示例

本文整理匯總了PHP中app\Article::fill方法的典型用法代碼示例。如果您正苦於以下問題:PHP Article::fill方法的具體用法?PHP Article::fill怎麽用?PHP Article::fill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Article的用法示例。


在下文中一共展示了Article::fill方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postCreate

 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postCreate(Request $request)
 {
     $data = $request->all();
     $this->article->fill($data);
     $this->article->save();
     return redirect()->to('articles/index');
 }
開發者ID:tadashi0713,項目名稱:laravelsample,代碼行數:11,代碼來源:ArticlesController.php

示例2: store

 public function store()
 {
     $article = new Article();
     $article->fill(\Input::only(['title', 'content']));
     $article->save();
     return redirect('/');
 }
開發者ID:nnanee,項目名稱:pronoob,代碼行數:7,代碼來源:HomeController.php

示例3: 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

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $article = new Article();
     $article->fill($request->except('published_at'));
     if ($request->get('is_published') == 'on') {
         $article->published_at = date('Y-m-d H:i:s', time());
     }
     $article->user_id = Auth::id();
     $article->save();
     return redirect('/admin/articles');
 }
開發者ID:TemRhythm,項目名稱:blog,代碼行數:17,代碼來源:ArticleController.php

示例5: transformArray

 private function transformArray($hits)
 {
     $arr = [];
     foreach ($hits as $item) {
         $article = new Article();
         $article->fill($item['_source']);
         $article->getUrl();
         $arr[] = $article;
     }
     return $arr;
 }
開發者ID:mgonzo,項目名稱:Laravel-Elasticsearch-React,代碼行數:11,代碼來源:ArticleRepository.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //dd($request->all());
     $this->validate($request, ['title' => 'required', 'slug' => 'unique:articles,slug', 'body' => 'required', 'published_at' => 'required|date', 'user_id' => 'required|integer']);
     $article = new Article();
     if ($request->hasFile('featured_image')) {
         $featured_image = $article->uploadImage($request->featured_image);
     }
     $article->fill(clean($request->all()));
     if (isset($featured_image)) {
         $article->featured_image = $featured_image;
     }
     $article->save();
     Session::flash('flash_message', 'Færslan var vistuð');
     return redirect()->back();
 }
開發者ID:dadigu,項目名稱:haskolabru,代碼行數:22,代碼來源:ArticlesController.php

示例7: update

 /**
  * Update the specified article in storage.
  *
  * @param Article $article
  * @param ArticleRequest $request
  * @return Response
  */
 public function update(Article $article, ArticleRequest $request)
 {
     $article->fill($request->all());
     $article->save() ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
     return redirect(route('admin.article.index'));
 }
開發者ID:santoshpawar,項目名稱:laravel-5-simple-cms,代碼行數:13,代碼來源:ArticleController.php

示例8: savePost

 /**
  * save.
  *
  * @param Article $article article
  * @param Request $input   輸入
  */
 public function savePost($article, $input)
 {
     $article->fill($input);
     return $article->save();
 }
開發者ID:lanzhiwang,項目名稱:laravel-blog,代碼行數:11,代碼來源:ArticleRepository.php


注:本文中的app\Article::fill方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。