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 Illuminate\Http\Request;
|
||||||
use App\User;
|
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
|
class RegistrationController extends Controller
|
||||||
{
|
{
|
||||||
public function create()
|
public function create()
|
||||||
@ -64,16 +65,26 @@ class RegistrationController extends Controller
|
|||||||
public function store()
|
public function store()
|
||||||
{
|
{
|
||||||
$this->validate(request(), [
|
$this->validate(request(), [
|
||||||
'name' => 'required',
|
'name' => 'required|alpha|min:3|max:45',
|
||||||
'surname' => 'required',
|
'surname' => 'required|alpha|min:3|max:45',
|
||||||
'email' => 'required|email',
|
'login' => 'required|alpha_num|min:3|max:45',
|
||||||
'password' => 'required',
|
'PESEL' => new Pesel,
|
||||||
'login' => 'required',
|
'phoneNumber' => 'required|digits:9',
|
||||||
'PESEL' => 'required',
|
'email' => 'required|email|unique:users',
|
||||||
'phoneNumber' => 'required'
|
'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();
|
$request = request();
|
||||||
$user = User::create([
|
$user = User::create([
|
||||||
@ -88,9 +99,11 @@ class RegistrationController extends Controller
|
|||||||
'degreeID' => 1,
|
'degreeID' => 1,
|
||||||
'number' => 'ABC123'
|
'number' => 'ABC123'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
auth()->login($user);
|
auth()->login($user);
|
||||||
|
|
||||||
return redirect()->to('/jednostka');
|
return redirect()->to('/jednostka');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user