Пример #1
0
 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();
 }
Пример #2
0
 /**
  * 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');
 }
 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()]);
     }
 }
 /**
  * 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');
 }
 /**
  * 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');
 }
 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'));
 }
Пример #7
0
 /**
  * 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'));
 }
 /**
  * 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');
 }
Пример #9
0
 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.');
 }
Пример #10
0
 /**
  * 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');
 }
 /**
  * API for updating a post
  */
 public function apiUpdatePost(PostRequest $request, Post $post)
 {
     $post->update($request->all());
     return $post;
 }
Пример #12
0
 /**
  * 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'));
 }
Пример #13
0
 /**
  * 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!');
 }
Пример #14
0
 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]];
 }
Пример #15
0
 /**
  * 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');
 }
Пример #16
0
 public function adminChange(User $user, Post $post)
 {
     if ($post->active == 0) {
         //the post is already disabled
         $post->update(['active' => 1]);
         Flash::success(trans('admin/messages.postActivate'));
     } elseif ($post->active == 1) {
         //the post is already enabled
         $post->update(['active' => 0]);
         Flash::success(trans('admin/messages.postBan'));
     }
     return redirect()->back();
 }
 public function update(Request $request, Post $post)
 {
     $post->update($request->all());
     return redirect('/blog/archive');
 }
Пример #18
0
 public function update(Request $request, Post $post)
 {
     $this->validate($request, ['title' => 'required', 'topic' => 'required|exists:topics,title', 'content' => 'required']);
     $post->update($request->all());
     return redirect()->to('posts/' . $post->slug);
 }