diff --git a/resources/lang/en/Pesel.php b/resources/lang/en/Pesel.php new file mode 100644 index 0000000..937d91f --- /dev/null +++ b/resources/lang/en/Pesel.php @@ -0,0 +1,60 @@ +validate(request(), [ + 'userEmail' => 'required|email', + 'userLogin' => 'required', + 'userPassword' => 'required', + 'userName' => 'required', + 'userLastName' => 'required', + 'userPesel' => 'required', + 'userPhone' => 'required', + + + ]); + + $request = request(); + + #$Uzytkownik = Uzytkownik::create(request(['userLogin', 'userPassword', 'userEmail'])); + $Uzytkownik = Uzytkownik::create([ + 'login' => $request-> userLogin, + 'password' => $request-> userPassword, + 'email' => $request-> userEmail, + 'name' => $request-> userName, + 'surname' => $request-> userLastName, + 'PESEL' => $request-> userPesel, + 'phoneNumber' => $request-> userPhone, + 'email' => $request-> userEmail, + 'functionID' => 1, + 'degreeID' => 1, + 'number' => 'ABC123' + + ]); + + auth()->login($Uzytkownik); + + return redirect()->to('/jednostka'); + } +} + +*/ +/* 'phoneNumber' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:9' */ +class RegistrationController extends Controller +{ + public function create() + { + return view('register'); + } + + public function store() + { + $this->validate(request(), [ + 'name' => 'required|alpha|min:3|max:45', + 'surname' => 'required|alpha|min:3|max:45', + 'login' => 'required|alpha_num|min:3|max:45', + 'PESEL' => new Pesel, + 'phoneNumber' => 'required|digits:9', + 'email' => 'required|email|unique:users', + 'password' => 'required|confirmed|min:6', + ], + [ + 'required' => ':attribute jest wymagany(e).', + 'min' => ':attribute musi mieć przynajmniej :min znaki.', + 'max' => ':attribute musi mieć nie więcej niż :max znaków.', + 'alpha' => ':attribute może zawierać tylko litery.', + 'alpha_num' => ':attribute może zawierać tylko litery i cyfry.', + 'digits' => ':attribute musi składać się z :digits cyfr.', + 'unique' =>':attribute jest już zajęty.', + 'confirmed' =>':attribute się nie zgadza.', + 'email' => 'Niepoprawny adres e-mail.' + ]); + + + $request = request(); + $user = User::create([ + 'login' => $request-> login, + 'password' => $request-> password, + 'email' => $request-> email, + 'name' => $request-> name, + 'surname' => $request-> surname, + 'PESEL' => $request-> PESEL, + 'phoneNumber' => $request-> phoneNumber, + 'functionID' => 1, + 'degreeID' => 1, + 'number' => 'ABC123' + ]); + + + auth()->login($user); + + return redirect()->to('/jednostka'); + } +} + diff --git a/resources/lang/en/register.blade.php b/resources/lang/en/register.blade.php new file mode 100644 index 0000000..e96d3a5 --- /dev/null +++ b/resources/lang/en/register.blade.php @@ -0,0 +1,120 @@ +@extends('layout.app') + + +@section('center-area') + @parent + + +{{--
--}} + +