1
0
forked from s421507/eOSP2

Test rejestracji

This commit is contained in:
czup 2019-08-30 02:12:27 +02:00
parent fe3518d8fe
commit 9cf1bf3bcb
3 changed files with 102 additions and 40 deletions

View File

@ -3,8 +3,10 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Uzytkownik;
use App\User;
/*
class RegistrationController extends Controller
{
//
@ -49,3 +51,28 @@ class RegistrationController extends Controller
return redirect()->to('/jednostka');
}
}
*/
class RegistrationController extends Controller
{
public function create()
{
return view('register');
}
public function store()
{
$this->validate(request(), [
'name' => 'required',
'email' => 'required|email',
'password' => 'required'
]);
$user = User::create(request(['name', 'email', 'password', 'testowa']));
auth()->login($user);
return redirect()->to('/jednostka');
}
}

View File

@ -5,6 +5,7 @@ namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
@ -16,7 +17,7 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
'name', 'email', 'password', 'testowa'
];
/**
@ -36,4 +37,9 @@ class User extends Authenticatable
protected $casts = [
'email_verified_at' => 'datetime',
];
public function setPasswordAttribute($password)
{
$this->attributes['password'] = bcrypt($password);
}
}

View File

@ -5,58 +5,87 @@
@parent
<form action="/register" method="post">
Użytkownik
{{-- <form action="/register" method="post">--}}
{{-- Użytkownik--}}
{{-- {{ csrf_field() }}--}}
{{-- <div class="form-group">--}}
{{-- <label for="title">Imię</label>--}}
{{-- <input type="text" class="form-control" id="userName" name="userName">--}}
{{-- </div>--}}
{{-- <div class="form-group">--}}
{{-- <label for="title">Nazwisko</label>--}}
{{-- <input type="text" class="form-control" id="userLastName" name="userLastName">--}}
{{-- </div>--}}
{{-- <div class="form-group">--}}
{{-- <label for="title">Pesel</label>--}}
{{-- <input type="text" class="form-control" id="userPesel" name="userPesel">--}}
{{-- </div>--}}
{{-- <div class="form-group">--}}
{{-- <label for="title">Email</label>--}}
{{-- <input type="text" class="form-control" id="userEmail" name="userEmail">--}}
{{-- </div>--}}
{{-- <div class="form-group">--}}
{{-- <label for="title">Numer telefonu</label>--}}
{{-- <input type="text" class="form-control" id="userPhone" name="userPhone">--}}
{{-- </div>--}}
{{-- <div class="form-group">--}}
{{-- <label for="title">Login</label>--}}
{{-- <input type="text" class="form-control" id="userLogin" name="userLogin">--}}
{{-- </div>--}}
{{-- <div class="form-group">--}}
{{-- <label for="title">Hasło</label>--}}
{{-- <input type="text" class="form-control" id="userPassword" name="userPassword">--}}
{{-- </div>--}}
{{-- <div class="form-group">--}}
{{-- <label for="title">Powtórz Hasło</label>--}}
{{-- <input type="text" class="form-control" id="userPassword2" name="userPassword2">--}}
{{-- </div>--}}
{{-- @if ($errors->any())--}}
{{-- <div class="alert alert-danger">--}}
{{-- <ul>--}}
{{-- @foreach ($errors->all() as $error)--}}
{{-- <li>{{ $error }}</li>--}}
{{-- @endforeach--}}
{{-- </ul>--}}
{{-- </div>--}}
{{-- @endif--}}
{{-- <button type="submit" class="btn btn-primary">Zarejestruj</button>--}}
{{-- </form>--}}
<h2>Register</h2>
<form method="POST" action="/register">
{{ csrf_field() }}
<div class="form-group">
<label for="title">Imię</label>
<input type="text" class="form-control" id="userName" name="userName">
</div>
<div class="form-group">
<label for="title">Nazwisko</label>
<input type="text" class="form-control" id="userLastName" name="userLastName">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" name="name">
</div>
<div class="form-group">
<label for="title">Pesel</label>
<input type="text" class="form-control" id="userPesel" name="userPesel">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" name="email">
</div>
<div class="form-group">
<label for="title">Email</label>
<input type="text" class="form-control" id="userEmail" name="userEmail">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" name="password">
</div>
<div class="form-group">
<label for="title">Numer telefonu</label>
<input type="text" class="form-control" id="userPhone" name="userPhone">
<label for="testowa">Wartosc Testowa:</label>
<input type="text" class="form-control" id="testowa" name="testowa">
</div>
<div class="form-group">
<label for="title">Login</label>
<input type="text" class="form-control" id="userLogin" name="userLogin">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Submit</button>
</div>
<div class="form-group">
<label for="title">Hasło</label>
<input type="text" class="form-control" id="userPassword" name="userPassword">
</div>
<div class="form-group">
<label for="title">Powtórz Hasło</label>
<input type="text" class="form-control" id="userPassword2" name="userPassword2">
</div>
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<button type="submit" class="btn btn-primary">Zarejestruj</button>
{{-- @include('partials.formerrors')--}}
</form>
@stop
@stop