forked from s421507/eOSP2
Prześlij pliki do 'app/Http/Controllers'
This commit is contained in:
parent
4cd4553e61
commit
999d7aa317
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\User;
|
||||
use App\Rules\Pesel;
|
||||
|
||||
|
||||
/*
|
||||
@ -53,7 +54,7 @@ class RegistrationController extends Controller
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/* 'phoneNumber' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:9' */
|
||||
class RegistrationController extends Controller
|
||||
{
|
||||
public function create()
|
||||
@ -64,16 +65,26 @@ class RegistrationController extends Controller
|
||||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'name' => 'required',
|
||||
'surname' => 'required',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
'login' => 'required',
|
||||
'PESEL' => 'required',
|
||||
'phoneNumber' => 'required'
|
||||
|
||||
'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([
|
||||
@ -88,9 +99,11 @@ class RegistrationController extends Controller
|
||||
'degreeID' => 1,
|
||||
'number' => 'ABC123'
|
||||
]);
|
||||
|
||||
|
||||
auth()->login($user);
|
||||
|
||||
return redirect()->to('/jednostka');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user