Esempio n. 1
0
 public function index()
 {
     if (!AuthController::checkPermission()) {
         return redirect('/auth/login')->with('redirectPath', '/admin');
     }
     return CoursesController::viewAllCourses();
 }
Esempio n. 2
0
 public static function destroy($id)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     $s = Subquestions::find($id);
     if (count($s) < 1) {
         return redirect('/');
     }
     $answers = Answers::where('SubQuestionID', '=', $id)->delete();
     $s->delete();
 }
 public static function destroy($SpaceID)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     $space = Spaces::find($SpaceID);
     $answers = Answers::where('SpaceID', '=', $SpaceID)->get()->toArray();
     foreach ($answers as $answer) {
         Answers::destroy($answer['id']);
     }
     $space->delete();
     return;
 }
Esempio n. 4
0
 public static function destroy($id)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     $post = Posts::find($id);
     @unlink(public_path('images/imagePost/' . $post['Photo']));
     $questions = Questions::where('PostID', '=', $id)->get()->toArray();
     foreach ($questions as $question) {
         QuestionsController::destroy($question['id']);
     }
     $courseid = $post['CourseID'];
     $post->delete();
     $course = Courses::find($post->CourseID);
     $course->NoOfPosts--;
     $course->update();
     return redirect(route('admin.viewcourse', $courseid));
 }
Esempio n. 5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public static function destroy($id)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     $course = Courses::find($id);
     $posts = Posts::where('CourseID', '=', $id)->get()->toArray();
     //        dd($posts);
     foreach ($posts as $post) {
         PostsController::destroy($post['id']);
         //            dd($post['id']);
     }
     $course->delete();
     return redirect(route('admin'));
 }
Esempio n. 6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public static function destroy($id)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     // return redirect('/');
     $answer = Answers::find($id);
     if (count($answer) < 1) {
         return redirect('/');
     }
     @unlink(public_path('images/imageAnswer/' . $answer['Photo']));
     $answer->delete();
 }
 public static function destroy($id)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     $question = Questions::find($id);
     @unlink(public_path('images/imageQuestion/' . $question['Photo']));
     $postid = $question['PostID'];
     $format = $question['FormatID'];
     switch ($format) {
         case 1:
         case 6:
             $answers = Answers::where('QuestionID', '=', $id)->get()->toArray();
             foreach ($answers as $answer) {
                 AnswersController::destroy($answer['id']);
             }
             break;
         case 2:
             $spaces = Spaces::where('QuestionID', '=', $id)->get()->toArray();
             foreach ($spaces as $value) {
                 SpacesController::destroy($value['id']);
             }
             break;
         case 3:
             $answers = Answers::where('QuestionID', '=', $id)->get()->toArray();
             foreach ($answers as $answer) {
                 AnswersController::destroy($answer['id']);
             }
             break;
         case 4:
             $answers = Answers::where('QuestionID', '=', $id)->get()->toArray();
             foreach ($answers as $answer) {
                 AnswersController::destroy($answer['id']);
             }
             break;
         case 5:
             $subq = Subquestions::where('QuestionID', '=', $id)->get()->toArray();
             foreach ($subq as $s) {
                 SubquestionsController::destroy($s['id']);
             }
     }
     $question->delete();
     return redirect(route('user.viewpost', $postid));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public static function destroy($id)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     $question = Questions::find($id);
     @unlink(public_path('images/imageQuestion/' . $question['Photo']));
     $postid = $question['PostID'];
     $format = Posts::find($postid)['FormatID'];
     if ($format == 1) {
         $answers = Answers::where('QuestionID', '=', $id)->get()->toArray();
         foreach ($answers as $answer) {
             Answers::destroy($answer['id']);
         }
     } else {
         if ($format == 2) {
             $spaces = Spaces::where('QuestionID', '=', $id)->get()->toArray();
             foreach ($spaces as $value) {
                 SpacesController::destroy($value['id']);
             }
         }
     }
     $question->delete();
     return redirect(route('user.viewpost', $postid));
 }
 public static function destroy($id)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     // return redirect('/');
     $s = Subquestions::find($id);
     if (count($s) < 1) {
         return redirect('/');
     }
     $answers = Answers::where('SubQuestionID', '=', $id)->get()->toArray();
     foreach ($answers as $a) {
         AnswersController::destroy($a['id']);
     }
     @unlink(public_path('images/imageSubquestion/' . $s['Photo']));
     $s->delete();
 }
Esempio n. 10
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if (!AuthController::checkPermission()) {
         return redirect('/');
     }
     $answer = Answers::find($id);
     $answer->delete();
 }