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


PHP ArticleRequest::except方法代碼示例

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


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

示例1: store

 public function store(ArticleRequest $request)
 {
     $article = new Article($request->except('images'));
     $article->user_id = $request->user()->id;
     $article->save();
     $files = Input::file('images');
     $uploads = '/uploads/';
     $path = public_path() . $uploads;
     foreach ($files as $file) {
         if (empty($file)) {
             continue;
         }
         $fileName = $file->getClientOriginalName();
         $file->move($path, $fileName);
         (new Image(['image' => $uploads . $fileName, 'article_id' => $article->id]))->save();
     }
     return redirect('articles');
 }
開發者ID:pavelhodak,項目名稱:myblog,代碼行數:18,代碼來源:ArticlesController.php

示例2: update

 /**
  * Update the specified resource in storage.
  * 編輯文章
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(ArticleRequest $request, $id)
 {
     $post = Article::find($id);
     $post->update($request->except('_method', '_token'));
     return redirect()->route('article.index');
 }
開發者ID:TenTail,項目名稱:Laravel-Blog-Test,代碼行數:13,代碼來源:ArticlesController.php

示例3: update

 /**
  * update an existing article
  *
  * @param  integer $id
  * @param  ArticleRequest $request
  * @return Response
  */
 public function update(Article $article, ArticleRequest $request)
 {
     $article->update($request->except('image'));
     $article->slug = str_slug($request->title, '-');
     if ($request->hasFile('image')) {
         $file = $request->file('image');
         $filename = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $image = sha1($filename . time()) . '.' . $extension;
         $destinationPath = public_path('/uploads/images/');
         $request->file('image')->move($destinationPath, $image);
         $article->image = $image;
     }
     $article->update();
     $this->syncTags($article, $request->input('tag_list'));
     flash()->info('Artikel telah diperbarui!');
     return redirect('/dashboard/articles');
 }
開發者ID:kobeuu,項目名稱:bpb-sf,代碼行數:25,代碼來源:ArticlesController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(ArticleRequest $request)
 {
     $image_name = $request->file('image')->getClientOriginalName();
     $request->file('image')->move(base_path() . '/public/images', $image_name);
     $article = $request->except(['image']);
     $article['image'] = $image_name;
     $article = Article::create($article);
     $categoriesId = $request->input('categoryList');
     $article->categories()->attach($categoriesId);
     $daysId = $request->input('dayList');
     $article->days()->attach($daysId);
     // GET INPUT
     $deals = $request->input('dealname');
     // GET ID OF ARTICLE
     $articleID = $article->id;
     // N is the day id that increments
     $n = 1;
     foreach ($deals as $deal) {
         Deal::create(['dealname' => $deal, 'article_id' => $articleID, 'dayID' => $n++]);
     }
     return redirect()->route('articles_path');
 }
開發者ID:lakemck,項目名稱:gethappy,代碼行數:28,代碼來源:ArticlesController.php


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