Advertisement
MrGoatsy

Untitled

Mar 3rd, 2021
1,183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1.     public function update(Request $request, Post $post) {
  2.         $this->authorize('update', $post);
  3.  
  4.         $this->validate($request, [
  5.             'body'  => [
  6.                 'required',
  7.                 'max:250'
  8.             ],
  9.         ]);
  10.  
  11.         Post::where('id', $request->route('posts'))->update([
  12.             'content'   => $request->body
  13.         ]);
  14.  
  15.         return back()->with('message', 'Your post has been updated.');
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement