SHARE
TWEET

Untitled

a guest Nov 13th, 2017 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top