Rejestracja bez logowania i zformatowanego formularza

This commit is contained in:
czup 2019-09-09 03:19:59 +02:00
parent 9cf1bf3bcb
commit 07471473ad
4 changed files with 58 additions and 12 deletions

View File

@ -65,11 +65,29 @@ class RegistrationController extends Controller
{
$this->validate(request(), [
'name' => 'required',
'surname' => 'required',
'email' => 'required|email',
'password' => 'required'
'password' => 'required',
'login' => 'required',
'PESEL' => 'required',
'phoneNumber' => 'required'
]);
$user = User::create(request(['name', 'email', 'password', 'testowa']));
$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);

View File

@ -11,13 +11,14 @@ class User extends Authenticatable
{
use Notifiable;
protected $primaryKey = 'id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'testowa'
'login', 'name', 'surname', 'password', 'PESEL', 'phoneNumber', 'email', 'fireStationID', 'functionID', 'degreeID', 'number', 'statusID', 'deleted', 'creatorID', 'changingID',
];
/**

View File

@ -15,10 +15,22 @@ class CreateUsersTable extends Migration
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('login', 45);
$table->string('password', 100);
$table->string('name', 45);
$table->string('surname', 45);
$table->string('PESEL',11);
$table->string('phoneNumber', 9);
$table->string('email', 50)->unique();
$table->integer('fireStationID')->nullable();
$table->integer('functionID');
$table->integer('degreeID');
$table->string('number', 45)->nullable()->default(null);
$table->integer('statusID')->default(0);
$table->integer('deleted')->default(0);
$table->integer('creatorID')->nullable()->default(null);
$table->integer('changingID')->nullable()->default(null);
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});

View File

@ -63,10 +63,30 @@
<form method="POST" action="/register">
{{ csrf_field() }}
<div class="form-group">
<label for="name">Name:</label>
<label for="name">Imię:</label>
<input type="text" class="form-control" id="name" name="name">
</div>
<div class="form-group">
<label for="name">Nazwisko:</label>
<input type="text" class="form-control" id="surname" name="surname">
</div>
<div class="form-group">
<label for="name">Login:</label>
<input type="text" class="form-control" id="login" name="login">
</div>
<div class="form-group">
<label for="name">Pesel:</label>
<input type="text" class="form-control" id="PESEL" name="PESEL">
</div>
<div class="form-group">
<label for="name">Numer telefonu:</label>
<input type="text" class="form-control" id="phoneNumber" name="phoneNumber">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" name="email">
@ -77,11 +97,6 @@
<input type="password" class="form-control" id="password" name="password">
</div>
<div class="form-group">
<label for="testowa">Wartosc Testowa:</label>
<input type="text" class="form-control" id="testowa" name="testowa">
</div>
<div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Submit</button>
</div>