示例#1
0
 public function hardDeleteBoard($id)
 {
     if (!Auth::check()) {
         return redirect("/");
     }
     if (Auth::user()->Level_id == 1) {
         return redirect('/managementAccount');
     }
     $data = Board::find($id);
     if (Auth::user()->id != $data->manager_id) {
         return redirect("/");
     }
     $cards = Card::where('Board_id', '=', $id)->get();
     $ids = [];
     foreach ($cards as $cards) {
         $ids[] = $cards['id'];
     }
     Checklist::whereIn('Card_id', $ids)->delete();
     Comment::whereIn('Card_id', $ids)->delete();
     Card::where('Board_id', '=', $id)->whereNotNull('child_id')->delete();
     Card::where('Board_id', '=', $id)->delete();
     Membermanagement::where('Board_id', '=', $id)->delete();
     $data->delete();
     return redirect('/home');
 }