Beispiel #1
0
*/
Route::get('/', function () {
    return View::make('profile');
})->before('auth');
Route::controller('/login', 'LoginController');
Route::controller('/logout', 'LogoutController');
Route::controller('/changeGroup', 'GroupController');
Route::get('/admin', function () {
    return View::make('admin');
})->before('auth');
Route::get('/insertVocab', function () {
    $word = new Word();
    $word->group_id = $_GET['group'];
    $word->english = $_GET['english'];
    $word->german = $_GET['german'];
    $word->save();
    return View::make('admin');
})->before('auth');
Route::post('/test_result', function () {
    return View::make('learn.test_result');
})->before('auth');
Route::controller('/stats', 'StatsController');
Route::post('/uploadCsv', function () {
    $data = $_POST['data'];
    $fileName = $_POST['fileName'];
    $serverFile = time() . $fileName;
    $fp = fopen('/uploads/' . $serverFile, 'w');
    //Prepends timestamp to prevent overwriting
    fwrite($fp, $data);
    fclose($fp);
    $returnData = array("serverFile" => $serverFile);