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


PHP Post::update方法代码示例

本文整理汇总了PHP中app\Post::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::update方法的具体用法?PHP Post::update怎么用?PHP Post::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Post的用法示例。


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

示例1: changeStatus

 public function changeStatus(Post $post)
 {
     if ($post->status == 1) {
         $post->update(['status' => 0]);
         Flash::success(trans('admin/messages.postBan'));
     } elseif ($post->status == 0) {
         $post->update(['status' => 1]);
         Flash::success(trans('admin/messages.postActivate'));
     }
     return redirect()->back();
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:11,代码来源:PostManagementController.php

示例2: update

 /**
  * PUT admin/posts/{post}
  *
  * @param Post        $post
  * @param PostRequest $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function update(Post $post, PostRequest $request)
 {
     $post->update($request->all());
     if ($request->has('tag_list')) {
         $post->tags()->sync(Tag::findOrCreateMany($request->get('tag_list')));
     }
     flash()->success('The post has been updated');
     return redirect('/admin/posts');
 }
开发者ID:spitzgoby,项目名称:spitzgoby,代码行数:16,代码来源:PostsController.php

示例3: save

 public function save(Post $post, Request $req)
 {
     if ($req->isMethod('post')) {
         $fields = [];
         foreach ($req->all() as $k => $v) {
             $fields[$k] = $v;
         }
         unset($fields['_token']);
         $post->update($fields);
         return view('post.post', ['posts' => Post::all()]);
     }
 }
开发者ID:zachjamesgreen,项目名称:newyogaadmin,代码行数:12,代码来源:PostController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param Requests\Post $request
  * @param Post $post
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function update(Requests\Post $request, Post $post)
 {
     $category = Category::find($request->get('category_id'));
     $post->update($request->all());
     if (!$request->has('slug')) {
         $post->slug = Str::slug($request->get('name'));
     }
     $category->posts()->save($post);
     return redirect('backend/posts');
 }
开发者ID:shempignon,项目名称:laravel-5-blog-mvc,代码行数:17,代码来源:PostController.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  Post  $post
  * @return Response
  */
 public function update(Post $post, PostRequest $request)
 {
     $post->update($request->all());
     $post->tags()->sync($request->input('tag_list', []));
     $post->slug = str_slug($post->title, "-");
     $post->save();
     return redirect('posts/postsAuth');
 }
开发者ID:grigoremihaela,项目名称:myfirstlaravel,代码行数:15,代码来源:PostsController.php

示例6: vote

 private function vote(Post $post, $vote)
 {
     if ($vote == 1) {
         $voteCount = $post->getAttributeValue('vote_count') + 1;
     } else {
         $voteCount = $post->getAttributeValue('vote_count') - 1;
     }
     $post->update(['vote_count' => $voteCount]);
     Auth::user()->post_vote()->create(['up' => $vote, 'post_id' => $post->getAttributeValue('id')]);
     return view('posts.show', compact('post'));
 }
开发者ID:khaled-barca,项目名称:MyTunnelVision,代码行数:11,代码来源:PostController.php

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Requests\PostRequest $request
  * @param  Post $post
  * @return \Response
  */
 public function update(Requests\PostRequest $request, $post)
 {
     $post->update($request->input());
     return redirect()->back()->with('success', trans('post.updated'));
 }
开发者ID:siberianwolf,项目名称:demo-laravel,代码行数:12,代码来源:PostController.php

示例8: update

 /**
  * Update your post.
  * 
  * @param  Post        $posts
  * @param  PostRequest $request
  * @return Response
  */
 public function update(Post $posts, PostRequest $request)
 {
     $posts->update($request->all());
     return redirect('posts');
 }
开发者ID:zhiephie,项目名称:artisan-sensation,代码行数:12,代码来源:PostsController.php

示例9: update

 public function update(PostRequest $request, Post $post)
 {
     $post->update($request->except(['_token']));
     $this->syncTags($post, $request->input('tag_list'));
     return redirect('dash/post')->with('message', 'Post was update success.');
 }
开发者ID:Yuth-Set,项目名称:cms,代码行数:6,代码来源:PostController.php

示例10: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Post $post, PostRequest $request)
 {
     $post->update($request->all());
     $post->tags()->sync($request->input('tags'));
     \Session::flash('flash_message_updated', 'Tu post ha sido actualizado');
     return redirect('posts');
 }
开发者ID:Zizazao,项目名称:evolutizalocal,代码行数:13,代码来源:indexController.php

示例11: apiUpdatePost

 /**
  * API for updating a post
  */
 public function apiUpdatePost(PostRequest $request, Post $post)
 {
     $post->update($request->all());
     return $post;
 }
开发者ID:goatatwork,项目名称:goldaccess-support,代码行数:8,代码来源:PostsController.php

示例12: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \App\Post $Post
  * @param  \Illuminate\Http\Request $request
  * @return Response
  */
 public function update(Post $post, Request $request)
 {
     $this->validate($request, $this->rules);
     $input = array_except(Input::all(), '_method');
     $post->update($input);
     return Redirect::route('superadmin.posts.index', $post->slug)->with('message', 'Post updated.');
     // show after update post
     //return view('posts.show', compact('post'));
 }
开发者ID:JRizzle88,项目名称:wewillcode,代码行数:16,代码来源:PostsController.php

示例13: update

 /**
  * Update the specified resource in storage.
  *
  * @param PostRequest $request
  * @return Response
  * @internal param int $id
  */
 public function update(Post $post, PostRequest $request)
 {
     $post->update($request->all());
     return redirect('posts')->with('flash_message', 'Post updated!');
 }
开发者ID:robjmills,项目名称:craftbeerfinder,代码行数:12,代码来源:PostController.php

示例14: postGroupDelete

 public function postGroupDelete(Request $request, Post $post, Comment $comment)
 {
     if ($request->user()->cannot('delete-problem-comment', [$post, $comment])) {
         return ['hasCallback' => 0, 'callback' => '', 'hasMsg' => 1, 'msg' => 'شما مجوز حذف این پست را ندارید.', 'msgType' => 'danger', 'returns' => ['num_comments' => '']];
     }
     $comment->delete();
     $num_comments = $post->comments()->count();
     $post->update(['num_comment' => $num_comments]);
     return ['hasCallback' => 1, 'callback' => 'post_comment_delete', 'hasMsg' => 0, 'msg' => '', 'msgType' => '', 'returns' => ['num_comments' => $num_comments]];
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:10,代码来源:CommentController.php

示例15: update

 /**
  * Update the specified resource in storage.
  *
  * @param PostRequest $request
  * @param User $user
  * @param Post $post
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function update(PostRequest $request, User $user, Post $post)
 {
     $post->update($request->all());
     // Using Input instead of Request due to an error when no tags selected
     $this->sync_tags($post, \Input::get('tag_list'));
     return redirect('users/' . $user->profile_link . '/posts');
 }
开发者ID:boxtar,项目名称:laratest,代码行数:15,代码来源:PostsController.php


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