Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $class_code = Request::Input('class_code');
     $students = Request::Input('students');
     $quiz = Request::Input('quiz');
     $class = new Classes();
     $class->class_name = Request::Input('class_name');
     $class->class_code = Request::Input('class_code');
     $class->save();
     for ($i = 0; $i < sizeof($quiz); $i++) {
         $class_quiz = new ClassesQuiz();
         $class_quiz->class_id = $class->id;
         $class_quiz->quiz_id = $quiz[$i];
         $class_quiz->save();
     }
     for ($i = 0; $i < sizeof($students); $i++) {
         $email = $students[$i];
         Mail::send('emails.classCode', compact('class_code'), function ($message) use($email) {
             $message->from('*****@*****.**', 'Qwizz!');
             $message->to($email);
             $message->bcc('*****@*****.**');
         });
     }
     $created = "CREATED";
     $Classes = Classes::all();
     return view('listClass')->with(compact('created'))->with(compact('Classes'));
 }
Ejemplo n.º 2
0
 public function deleteclass($id)
 {
     Classes::where('id', '=', $id)->delete();
     StudentsList::where('ClassID', '=', $id)->delete();
     return redirect()->route('subadmin.view');
 }
Ejemplo n.º 3
0
 public function addClass($id)
 {
     $users = User::all()->where('id', $id)->lists('last_name', 'id');
     $classes = Classes::all()->lists('class_code', 'id');
     return view('addClass', compact('users', 'classes'));
 }
Ejemplo n.º 4
0
 public function delete($id)
 {
     Classes::findOrFail($id)->delete();
     Session::flash('message', 'Data successfully deleted');
     return redirect('classes');
 }