Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function comment(string $slug, PostRepository $repository, CommentRequest $request)
- {
- $this->authorize('create', Comment::class);
- Comment::create([
- 'post_id' => $repository->getPostBySlug($slug)->id,
- 'author' => Auth::user()->name,
- 'text' => $request->input('text'),
- ]);
- return Response::json(['success' => 'Комментарий успешно добавлен']);
- }
Advertisement
Add Comment
Please, Sign In to add comment