}); Route::get('/choose', function (Request $request) { $student = Student::loggedIn(); if (empty($student)) { return redirect('/'); } $activities = Activity::where('sex', '=', $student->sex)->orWhere('sex', '=', 2)->get(); return View::make('choose')->with(compact('student', 'activities')); }); Route::post('/choose', function (Request $request) { $a1 = Input::get('a1'); $a2 = Input::get('a2'); if ($a1 == null || $a2 == null) { Session::flash('error', 'לא סימנת שתי פעילויות'); } else { $student = Student::loggedIn(); $oldA1 = $student->a1; $oldA2 = $student->a2; $student->a1 = $a1; $student->a2 = $a2; if (($student->a1->a1Available || ($oldA1 = $a1)) && ($student->a2->a2Available || ($oldA2 = $a2))) { if ($student->save()) { Session::flash('error', 'נרשמת בהצלחה!'); return redirect('/choose'); } } Session::flash('error', 'אירעה שגיאה. אנא נסה שוב.'); } return redirect('/choose'); }); Route::get('/activity/{id}', function ($id) {