<commit_before><?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Http\Requests\RegisterUser;
use App\Mail\UserRegistered;
use App\User;
use Illuminate\Support\Facades\Mail;


class RegisterController extends Controller
{
    public function __construct()
    {
        $this->middleware('guest');
    }

    /*
     * Show registration form
     */
    public function create()
    {
        return view('registration.create');
    }

    /**
     * Register user
     */
    public function store(RegisterUser $request)
    {
        //create user
        $user = User::create([
            'email' => request('email'),
            'password' => <PASSWORD>(request('password')),
            'name' => request('email')
        ]);

        //log in user | we can use facade auth also
        \Auth::login($user);

        //send welcome email to user
        Mail::to($user)->send(new UserRegistered($user));

        //redirect to home<commit_msg>custom validation with less magic<commit_after><?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Mail\UserRegistered;
use App\User;
use Validator;
use Illuminate\Support\Facades\Mail;


class RegisterController extends Controller
{
    public function __construct()
    {
        $this->middleware('guest');
    }

    /*
     * Show registration form
     */
    public function create()
    {
        return view('registration.create');
    }

    /**
     * Register user
     */
    public function store(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'email' => 'required|email|unique:users',
            'password' => '<PASSWORD>',
            'name' => 'required|min:2'
        ]);

        if ($validator->fails()) {
            return back()->withErrors($validator)->withInput();
        }
        
        //create user
        $user = User::create([
            'email' => request('email'),
            'password' => <PASSWORD>(request('password')),
            'name' => request('email')
        ]);

        //log in user | we can use facade auth also
        \Auth::login($user);

        //send welcome email to user
        Mail::to($user)->send(new UserRegistered($user));

        //redirect to home
{'fraction_non_alphanumeric': 0.1410090556274256, 'fraction_numerical': 0.00043122035360068997, 'mean_word_length': 2.2402234636871508, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 23, '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': '127394', 'n_tokens_mistral': 641, 'n_tokens_neox': 642, 'n_words': 147}