<commit_before><?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::pattern('id', '[0-9]+');

Route::get('/', [
    'as'   => 'index',
    'uses' => 'PagesController@getHomepage'
]);

Route::group(['middleware' => 'oauth'], function () {
    Route::get('/menu', [
        'as'   => 'menu',
        'middleware' => 'authorize:student',
        'uses' => 'PagesController@getMenu'
    ]);
});

Route::group(['prefix' => 'referrals'], function () {
    Route::group(['middleware' => 'oauth'], function () {
        Route::get('/firsttime', [
            'as'   => 'referrals.firsttime',
            'middleware' => 'authorize:student',
            'uses' => 'ReferralsController@firstTime'
        ]);

        Route::get('/', [
            'as'   => 'referrals.edit',
            'middleware' => 'authorize:referral,edit',
            'uses' => 'ReferralsController@edit'
        ]);

        Route::post('/', [
            'as'   => 'referrals.update',
            'middleware' => 'authorize:referral,edit',
            'uses' => 'ReferralsController@update'
        ]);
        Route::get('/destroy', [
            'as'   => 'referrals.destroy',
            'middleware' => 'authorize:referral,edit',
            'uses' => 'ReferralsController@destroy'
        ]);
    });
});

Route::group(['prefix' => 'dashboard'], function () {
    Route::group(['middleware' => ['oauth']], function () {
        Route::get('/', [
            'as'   => 'dashboard.index',
            'middleware' => 'authorize:volunteer',
            'uses' => 'DashboardController@getIndex'
        ]);

        // Delete, validate and edit referrals.
        Route::group(['prefix' => 'referrals'], function () {
            Route::get('/validation', [
                'as'   => 'dashboard.referrals.validation',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@getValidation'
            ]);
            Route::post('/validation', [
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@postValidation'
            ]);
            Route::get('/list', [
                'as'   => 'dashboard.referrals.list',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@index'
            ]);
            Route::get('/match', [
                'as'   => 'dashboard.referrals.match',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@matchToNewcomers'
            ]);
            Route::get('/prematch', [
                'as'   => 'dashboard.referrals.prematch',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@prematch'
            ]);
            Route::post('/prematch', [
                'as'   => 'dashboard.referrals.prematch.submit',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@prematchSubmit'
            ]);
        });

        // ce
        Route::group(['prefix' => 'ce'], function () {
            Route::get('/firsttime', [
                'as'   => 'dashboard.ce.firsttime',
                'middleware' => 'authorize:student',
                'uses' => 'CEController@firstTime'
            ]);

            Route::get('/teamlist', [
                'as'   => 'dashboard.ce.teamlist',
                'middleware' => 'authorize:ce',
                'uses' => 'CEController@teamList'
            ]);

            Route::post('/teamcreate', [
                'as'   => 'dashboard.ce.teamcreate',
                'middleware' => 'authorize:ce,create',
                'uses' => 'CEController@teamCreate'
            ]);

            Route::get('/myteam', [
                'as'   => 'dashboard.ce.myteam',
                'middleware' => 'authorize:ce',
                'uses' => 'CEController@myteam'
            ]);

            Route::post('/myteam', [
                'middleware' => 'authorize:ce,edit',
                'uses' => 'CEController@myTeamSubmit'
            ]);

            Route::get('/add', [
                'as'   => 'dashboard.ce.add',
                'middleware' => 'authorize:ce,edit',
                'uses' => 'CEController@add'
            ]);

            Route::get('/add/{login}', [
                'as'   => 'dashboard.ce.addsubmit',
                'middleware' => 'authorize:ce,edit',
                'uses' => 'CEController@addSubmit'
            ]);

            Route::get('/join', [
                'as'   => 'dashboard.ce.join',
                'middleware' => 'authorize:ce,join',
                'uses' => 'CEController@join'
            ]);

            Route::get('/unjoin', [
                'as'   => 'dashboard.ce.unjoin',
                'middleware' => 'authorize:ce,join',
                'uses' => 'CEController@unjoin'
            ]);
        });

        // Teams management.
        Route::group(['prefix' => 'teams'], function () {
            Route::get('/', [
                'as'   => 'dashboard.teams.list',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@list'
            ]);
            Route::get('/{id}/validate', [
                'as'   => 'dashboard.teams.validate',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@adminValidate'
            ]);
            Route::get('/{id}/unvalidate', [
                'as'   => 'dashboard.teams.unvalidate',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@adminUnvalidate'
            ]);
            Route::get('/{id}/edit', [
                'as'   => 'dashboard.teams.edit',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@edit'
            ]);
            Route::post('/{id}/edit', [
                'as'   => 'dashboard.teams.edit.submit',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@editSubmit'
            ]);
            Route::get('/match', [
                'as'   => 'dashboard.teams.match',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@matchToNewcomers'
            ]);
            // 	Route::post('/{id}/members', [
            // 		'as'   => 'dashboard.teams.members',
            // 		'uses' => 'TeamsController@addMember'
            // 	]);
        });

        // Newcomers management.
        Route::group(['prefix' => 'newcomers'], function () {
            Route::get('/', [
                'as'   => 'dashboard.newcomers.list',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@list'
            ]);
            Route::post('/create', [
                'as'   => 'dashboard.newcomers.create',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@create'
            ]);
            Route::post('/createcsv', [
                'as'   => 'dashboard.newcomers.createcsv',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@createcsv'
            ]);
            Route::get('/letter/{id}', [
                'as'   => 'dashboard.newcomers.letter',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@letter',
            ]);
            Route::get('/letter/{id}-{limit}', [
                'as'   => 'dashboard.newcomers.letters',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@letter',
            ]);
            Route::get('/letter/{category}/{id}-{limit}', [
                'as'   => 'dashboard.newcomers.filtered_letters',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@letter',
            ])->where(['id' => '[0-9]+', 'category' => '[A-Z]+', 'limit' => '[0-9]+']);
        });

<commit_msg>Route letter condition<commit_after><?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::pattern('id', '[0-9]+');

Route::get('/', [
    'as'   => 'index',
    'uses' => 'PagesController@getHomepage'
]);

Route::group(['middleware' => 'oauth'], function () {
    Route::get('/menu', [
        'as'   => 'menu',
        'middleware' => 'authorize:student',
        'uses' => 'PagesController@getMenu'
    ]);
});

Route::group(['prefix' => 'referrals'], function () {
    Route::group(['middleware' => 'oauth'], function () {
        Route::get('/firsttime', [
            'as'   => 'referrals.firsttime',
            'middleware' => 'authorize:student',
            'uses' => 'ReferralsController@firstTime'
        ]);

        Route::get('/', [
            'as'   => 'referrals.edit',
            'middleware' => 'authorize:referral,edit',
            'uses' => 'ReferralsController@edit'
        ]);

        Route::post('/', [
            'as'   => 'referrals.update',
            'middleware' => 'authorize:referral,edit',
            'uses' => 'ReferralsController@update'
        ]);
        Route::get('/destroy', [
            'as'   => 'referrals.destroy',
            'middleware' => 'authorize:referral,edit',
            'uses' => 'ReferralsController@destroy'
        ]);
    });
});

Route::group(['prefix' => 'dashboard'], function () {
    Route::group(['middleware' => ['oauth']], function () {
        Route::get('/', [
            'as'   => 'dashboard.index',
            'middleware' => 'authorize:volunteer',
            'uses' => 'DashboardController@getIndex'
        ]);

        // Delete, validate and edit referrals.
        Route::group(['prefix' => 'referrals'], function () {
            Route::get('/validation', [
                'as'   => 'dashboard.referrals.validation',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@getValidation'
            ]);
            Route::post('/validation', [
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@postValidation'
            ]);
            Route::get('/list', [
                'as'   => 'dashboard.referrals.list',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@index'
            ]);
            Route::get('/match', [
                'as'   => 'dashboard.referrals.match',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@matchToNewcomers'
            ]);
            Route::get('/prematch', [
                'as'   => 'dashboard.referrals.prematch',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@prematch'
            ]);
            Route::post('/prematch', [
                'as'   => 'dashboard.referrals.prematch.submit',
                'middleware' => 'authorize:admin',
                'uses' => 'ReferralsController@prematchSubmit'
            ]);
        });

        // ce
        Route::group(['prefix' => 'ce'], function () {
            Route::get('/firsttime', [
                'as'   => 'dashboard.ce.firsttime',
                'middleware' => 'authorize:student',
                'uses' => 'CEController@firstTime'
            ]);

            Route::get('/teamlist', [
                'as'   => 'dashboard.ce.teamlist',
                'middleware' => 'authorize:ce',
                'uses' => 'CEController@teamList'
            ]);

            Route::post('/teamcreate', [
                'as'   => 'dashboard.ce.teamcreate',
                'middleware' => 'authorize:ce,create',
                'uses' => 'CEController@teamCreate'
            ]);

            Route::get('/myteam', [
                'as'   => 'dashboard.ce.myteam',
                'middleware' => 'authorize:ce',
                'uses' => 'CEController@myteam'
            ]);

            Route::post('/myteam', [
                'middleware' => 'authorize:ce,edit',
                'uses' => 'CEController@myTeamSubmit'
            ]);

            Route::get('/add', [
                'as'   => 'dashboard.ce.add',
                'middleware' => 'authorize:ce,edit',
                'uses' => 'CEController@add'
            ]);

            Route::get('/add/{login}', [
                'as'   => 'dashboard.ce.addsubmit',
                'middleware' => 'authorize:ce,edit',
                'uses' => 'CEController@addSubmit'
            ]);

            Route::get('/join', [
                'as'   => 'dashboard.ce.join',
                'middleware' => 'authorize:ce,join',
                'uses' => 'CEController@join'
            ]);

            Route::get('/unjoin', [
                'as'   => 'dashboard.ce.unjoin',
                'middleware' => 'authorize:ce,join',
                'uses' => 'CEController@unjoin'
            ]);
        });

        // Teams management.
        Route::group(['prefix' => 'teams'], function () {
            Route::get('/', [
                'as'   => 'dashboard.teams.list',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@list'
            ]);
            Route::get('/{id}/validate', [
                'as'   => 'dashboard.teams.validate',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@adminValidate'
            ]);
            Route::get('/{id}/unvalidate', [
                'as'   => 'dashboard.teams.unvalidate',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@adminUnvalidate'
            ]);
            Route::get('/{id}/edit', [
                'as'   => 'dashboard.teams.edit',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@edit'
            ]);
            Route::post('/{id}/edit', [
                'as'   => 'dashboard.teams.edit.submit',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@editSubmit'
            ]);
            Route::get('/match', [
                'as'   => 'dashboard.teams.match',
                'middleware' => 'authorize:admin',
                'uses' => 'TeamsController@matchToNewcomers'
            ]);
            // 	Route::post('/{id}/members', [
            // 		'as'   => 'dashboard.teams.members',
            // 		'uses' => 'TeamsController@addMember'
            // 	]);
        });

        // Newcomers management.
        Route::group(['prefix' => 'newcomers'], function () {
            Route::get('/', [
                'as'   => 'dashboard.newcomers.list',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@list'
            ]);
            Route::post('/create', [
                'as'   => 'dashboard.newcomers.create',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@create'
            ]);
            Route::post('/createcsv', [
                'as'   => 'dashboard.newcomers.createcsv',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@createcsv'
            ]);
            Route::get('/letter/{id}', [
                'as'   => 'dashboard.newcomers.letter',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@letter',
            ]);
            Route::get('/letter/{id}-{limit}', [
                'as'   => 'dashboard.newcomers.letters',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@letter',
            ]);
            Route::get('/letter/{id}-{limit}-{category}', [
                'as'   => 'dashboard.newcomers.filtered_letters',
                'middleware' => 'authorize:admin',
                'uses' => 'NewcomersController@letter',
            ])->where(['id' => '[0-9]+', 'category' => '[A-Z]+', 'limit' => '[0-9]+']);
        });


{'fraction_non_alphanumeric': 0.1962341334295855, 'fraction_numerical': 0.0007218913553510197, 'mean_word_length': 1.5245254365983296, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 231, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6675259', 'n_tokens_mistral': 4705, 'n_tokens_neox': 4495, 'n_words': 646}