Пример #1
0
 public function destroy($id)
 {
     $reply = Reply::findOrFail($id);
     $user = app('Dingo\\Api\\Auth\\Auth')->user();
     if (Gate::forUser($user)->denies('delete-reply', $reply)) {
         throw new AccessDeniedHttpException();
     }
     if ($reply->delete()) {
         return $this->response()->item($reply, new ReplyTransformer());
     } else {
         throw new DeleteResourceFailedException('删除失败,请重新尝试');
     }
 }