<commit_before><?php

use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

/*
|--------------------------------------------------------------------------
| 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.
|
*/

/**
 * Show User Dashboard
 */
Route::get('/', function () {
    $users = User::orderBy('created_at', 'asc')->get();
    
    $occupations = [
        '' => '',
        'student' => 'Student',
        'medic' => 'Medic',
        'driver' => 'Driver',
        'developer' => 'Software Developer'
    ];
    
    return view('users', [
        'users' => $users,
        'occupations' => $occupations
    ]);
});

/**
 * Add New User
 */
Route::post('/user', function (Request $request) {
    $validator = validator::make($request->all(), [
        'name' => 'required|max:255',
        'email' => 'required',
        'birthday' => 'required|date_format:Y-m-d',
        'occupation' => 'required'
    ]);
    
    if ($validator->fails()) {
        return redirect('/')
            ->withInput()
            ->withErrors($validator);
    }
    
    $user = new User;
    
    $user->name = $request->name;
    $user->email = $request->email;
    $user->birthday = $request->birthday;
    $user->occupation = $request->occupation;
    $user->notes = $request->notes;
    
    $user->save();
    <commit_msg>fixed email validation<commit_after><?php

use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

/*
|--------------------------------------------------------------------------
| 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.
|
*/

/**
 * Show User Dashboard
 */
Route::get('/', function () {
    $users = User::orderBy('created_at', 'asc')->get();
    
    $occupations = [
        '' => '',
        'student' => 'Student',
        'medic' => 'Medic',
        'driver' => 'Driver',
        'developer' => 'Software Developer'
    ];
    
    return view('users', [
        'users' => $users,
        'occupations' => $occupations
    ]);
});

/**
 * Add New User
 */
Route::post('/user', function (Request $request) {
    $validator = validator::make($request->all(), [
        'name' => 'required|max:255',
        'email' => 'required|email',
        'birthday' => 'required|date_format:Y-m-d',
        'occupation' => 'required'
    ]);
    
    if ($validator->fails()) {
        return redirect('/')
            ->withInput()
            ->withErrors($validator);
    }
    
    $user = new User;
    
    $user->name = $request->name;
    $user->email = $request->email;
    $user->birthday = $request->birthday;
    $user->occupation = $request->occupation;
    $user->notes = $request->notes;
    
    $user->save();
    
{'fraction_non_alphanumeric': 0.2549019607843137, 'fraction_numerical': 0.0018674136321195146, 'mean_word_length': 1.8267370272647319, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7431648', 'n_tokens_mistral': 923, 'n_tokens_neox': 920, 'n_words': 216}