forked from s421507/eOSP2
97 lines
2.3 KiB
PHP
97 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\User;
|
|
|
|
|
|
/*
|
|
class RegistrationController extends Controller
|
|
{
|
|
//
|
|
public function create()
|
|
{
|
|
return view('register');
|
|
}
|
|
public function store()
|
|
{
|
|
$this->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');
|
|
}
|
|
}
|
|
|
|
*/
|
|
|
|
class RegistrationController extends Controller
|
|
{
|
|
public function create()
|
|
{
|
|
return view('register');
|
|
}
|
|
|
|
public function store()
|
|
{
|
|
$this->validate(request(), [
|
|
'name' => 'required',
|
|
'surname' => 'required',
|
|
'email' => 'required|email',
|
|
'password' => 'required',
|
|
'login' => 'required',
|
|
'PESEL' => 'required',
|
|
'phoneNumber' => 'required'
|
|
|
|
]);
|
|
|
|
|
|
$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');
|
|
}
|
|
}
|