當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Comment::delete方法代碼示例

本文整理匯總了PHP中app\Comment::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Comment::delete方法的具體用法?PHP Comment::delete怎麽用?PHP Comment::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Comment的用法示例。


在下文中一共展示了Comment::delete方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: destroy

 public function destroy(Comment $comment)
 {
     if ($comment->user_id != Auth::user()->id && !Entrust::hasRole('admin')) {
         return redirect()->back()->withErrors(config('constants.INVALID_LINK'));
     }
     $belongs_to = $comment->belongs_to;
     $comment->delete();
     $activity = 'Deleted a commented on a ' . ucfirst($belongs_to);
     Activity::log($activity);
     return redirect()->back()->withSuccess(config('constants.DELETED'));
 }
開發者ID:EneaWeb,項目名稱:aliangel,代碼行數:11,代碼來源:CommentController.php

示例2: recursiveDestroy

 /**
  * Delete comment recursively
  *
  * @param \App\Comment $comment
  * @return bool|null
  */
 public function recursiveDestroy(Comment $comment)
 {
     if ($comment->replies->count()) {
         $comment->replies->each(function ($reply) {
             if ($reply->replies->count()) {
                 $this->recursiveDestroy($reply);
             } else {
                 $reply->delete();
             }
         });
     }
     return $comment->delete();
 }
開發者ID:gabrieljo,項目名稱:l5essential,代碼行數:19,代碼來源:CommentsController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param Comment $comment
  * @return \Illuminate\Http\Response
  */
 public function destroy(Comment $comment)
 {
     if ($comment->user()->getResults() != Auth::user()) {
         return response('Unauthorized.', 401);
     }
     return view('posts.show', compact($comment->delete()));
 }
開發者ID:khaled-barca,項目名稱:MyTunnelVision,代碼行數:13,代碼來源:CommentController.php

示例4: delete

 public function delete(Request $request, Comment $comment)
 {
     $comment->delete($request->all());
     flash('Your comment has been deleted.', 'error');
     return back();
 }
開發者ID:Craig115,項目名稱:event-album,代碼行數:6,代碼來源:CommentController.php

示例5: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Comment $comment)
 {
     $this->authorize('deleteComment', \Auth::user());
     $comment->delete();
     return redirect(route('article.show', [$comment->article->slug]))->with('flash_success', 'Комментарий успешно удален.');
 }
開發者ID:Ravend6,項目名稱:laravel_base_v5.2,代碼行數:12,代碼來源:CommentController.php

示例6: destroy

 public function destroy(Comment $comment)
 {
     $comment->delete();
     return redirect('dash/comment')->with('message', 'Page was delete success.');
 }
開發者ID:Yuth-Set,項目名稱:cms,代碼行數:5,代碼來源:CommentController.php

示例7: destroy

 public function destroy(Post $post, Comment $comment)
 {
     $comment->delete();
     return response(['url' => url('posts/' . $post->slug)]);
 }
開發者ID:enhive,項目名稱:vev,代碼行數:5,代碼來源:CommentController.php

示例8: adminAnswerDelete

 public function adminAnswerDelete(User $user, Comment $comment)
 {
     $comment->delete();
     Flash::success(trans('admin/message.answerDeleted'));
     return redirect()->back();
 }
開發者ID:emadmrz,項目名稱:Hawk,代碼行數:6,代碼來源:CommentController.php

示例9: destroy

 /**
  * Remove the specified resource from storage, if run twice it permanently deletes it
  *
  * @param  Comment  $comment The comment you want to destroy
  * @return Response
  */
 public function destroy(Comment $comment)
 {
     if ($comment->user->id != Auth::user()->id && !Auth::user()->can('delete-comments')) {
         abort(401, 'User does not have permission to delete this comment');
     }
     $comment->delete();
     return $comment;
 }
開發者ID:dwoodard,項目名稱:IserveU,代碼行數:14,代碼來源:CommentController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(RentalUnit $rentalUnit, Comment $comment)
 {
     $comment->delete();
 }
開發者ID:VJan-fin,項目名稱:Roomie,代碼行數:10,代碼來源:CommentController.php


注:本文中的app\Comment::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。