예제 #1
0
        do {
            $rnd = generateRandomString(5);
        } while (Course::where('u_identifier', '=', $rnd)->first() != NULL);
        $course->u_identifier = $rnd;
        $course->name = $course_installer->name;
        $course->description = $course_installer->description;
        $course->maxStudentsPerStripe = $course_installer->maxStudentsPerStripe;
        $course->single_stripe = $course_installer->single_stripe;
        $course->referents = $course_installer->referents;
        $course->save();
        for ($c = 0; $c < 9; $c++) {
            if (intval($course_installer->{itoa($c + 1)}) != 0) {
                $stripe = new Stripe();
                $stripe->stripe_number = $c + 1;
                $stripe->stripe_call = $course_installer->{itoa($c + 1)};
                $course->stripes()->save($stripe);
            }
        }
    }
    return redirect(route("admin"))->withSuccess("Corsi importati con successo.");
}]);
// ------
// Authentication routes
Route::get('/', ['as' => 'auth.getLogin', 'uses' => 'Auth\\AuthController@getLogin']);
Route::post('auth/login', ['as' => 'auth.postLogin', 'uses' => 'Auth\\AuthController@postLogin']);
Route::get('auth/logout', ['as' => 'auth.logout', 'uses' => 'Auth\\AuthController@getLogout']);
// Registration routes
Route::get('auth/register', ['as' => 'auth.getRegister', 'uses' => 'Auth\\AuthController@getRegister']);
Route::post('auth/register', 'Auth\\AuthController@postRegister');
// SIGNUP - QUIT
Route::post('/courses/{course_id}/signup/', function ($course_id) {
예제 #2
0
 public function quitStripes(Course $course, $stripe_numbers)
 {
     foreach ($stripe_numbers as $stripe_number) {
         $this->stripes()->detach($course->stripes()->where('stripe_number', '=', $stripe_number)->first()->id);
     }
 }