Guest User

Untitled

a guest
Feb 13th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. public function comment(string $slug, PostRepository $repository, CommentRequest $request)
  2. {
  3.     $this->authorize('create', Comment::class);
  4.  
  5.     Comment::create([
  6.         'post_id' => $repository->getPostBySlug($slug)->id,
  7.         'author' => Auth::user()->name,
  8.         'text' => $request->input('text'),
  9.     ]);
  10.  
  11.     return Response::json(['success' => 'Комментарий успешно добавлен']);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment