Advertisement
Guest User

Untitled

a guest
Nov 13th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.80 KB | None | 0 0
  1. class ReplyController extends Controller
  2. {
  3.     public function __construct()
  4.     {
  5.         $this->middleware('auth');
  6.     }
  7.  
  8.  
  9.     public function store($channelId, Post $post)
  10.     {
  11.  
  12.         $post->addReply([
  13.             'text' => request('text'),
  14.             'user_id' => auth()->id()
  15.         ]);
  16.  
  17.         return back()->with('flash', 'Uw reactie is geplaatst!');
  18.     }
  19.  
  20.     public function destroy(Reply $reply)
  21.     {
  22.         $this->authorize('update', $reply);
  23.  
  24.         $reply->delete();
  25.  
  26.         if (request()->expectsJson()) {
  27.             return response(['status' => 'Reactie verwijderd']);
  28.         }
  29.  
  30.         return back();
  31.     }
  32.  
  33.     public function update(Reply $reply)
  34.     {
  35.         $this->authorize('update', $reply);
  36.  
  37.         $reply->update(request(['text']));
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement