Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ReplyController extends Controller
- {
- public function __construct()
- {
- $this->middleware('auth');
- }
- public function store($channelId, Post $post)
- {
- $post->addReply([
- 'text' => request('text'),
- 'user_id' => auth()->id()
- ]);
- return back()->with('flash', 'Uw reactie is geplaatst!');
- }
- public function destroy(Reply $reply)
- {
- $this->authorize('update', $reply);
- $reply->delete();
- if (request()->expectsJson()) {
- return response(['status' => 'Reactie verwijderd']);
- }
- return back();
- }
- public function update(Reply $reply)
- {
- $this->authorize('update', $reply);
- $reply->update(request(['text']));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement