Exemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request\PresentationRequest  $request
  * @return \Illuminate\Http\Response
  */
 public function store(PresentationRequest $request)
 {
     if (!current_conference()) {
         flash()->error("You can't create a presentation yet!");
         return redirect(route('user.show'));
     }
     $fields = $request->all();
     $students = $fields['student_name'];
     if (empty($students[0])) {
         flash()->error("At least one student is required!");
         return back()->withInput();
     }
     unset($fields['student_name']);
     $user = Auth::user();
     $presentation = new Presentation($fields);
     $presentation->owner = $user->id;
     $presentation->conference_id = get_current_conference_id();
     if ($user->is_admin()) {
         $presentation->status = "A";
     } else {
         $presentation->status = "S";
     }
     if ($presentation->save()) {
         $this->save_students($students, $presentation->id);
         flash()->success("Presentation saved.");
     } else {
         flash()->error("Presentation couldn't be saved");
     }
     return redirect()->route('user.show');
 }
Exemplo n.º 2
0
 public function publish()
 {
     $current_conference = current_conference();
     $current_conference->published = true;
     $current_conference->save();
     flash()->success('The schedule is now published.');
     return redirect()->route('timeslot.preview');
 }