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,14 +65,24 @@ 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.'
|
||||
]);
|
||||
|
||||
|
||||
@ -89,8 +100,10 @@ class RegistrationController extends Controller
|
||||
'number' => 'ABC123'
|
||||
]);
|
||||
|
||||
|
||||
auth()->login($user);
|
||||
|
||||
return redirect()->to('/jednostka');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user