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; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Uzytkownik; use App\User;
/*
class RegistrationController extends Controller class RegistrationController extends Controller
{ {
// //
@ -49,3 +51,28 @@ class RegistrationController extends Controller
return redirect()->to('/jednostka'); 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\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable class User extends Authenticatable
{ {
@ -16,7 +17,7 @@ class User extends Authenticatable
* @var array * @var array
*/ */
protected $fillable = [ protected $fillable = [
'name', 'email', 'password', 'name', 'email', 'password', 'testowa'
]; ];
/** /**
@ -36,4 +37,9 @@ class User extends Authenticatable
protected $casts = [ protected $casts = [
'email_verified_at' => 'datetime', 'email_verified_at' => 'datetime',
]; ];
public function setPasswordAttribute($password)
{
$this->attributes['password'] = bcrypt($password);
}
} }

View File

@ -5,58 +5,87 @@
@parent @parent
<form action="/register" method="post"> {{-- <form action="/register" method="post">--}}
Użytkownik {{-- 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() }} {{ csrf_field() }}
<div class="form-group"> <div class="form-group">
<label for="title">Imię</label> <label for="name">Name:</label>
<input type="text" class="form-control" id="userName" name="userName"> <input type="text" class="form-control" id="name" name="name">
</div>
<div class="form-group">
<label for="title">Nazwisko</label>
<input type="text" class="form-control" id="userLastName" name="userLastName">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="title">Pesel</label> <label for="email">Email:</label>
<input type="text" class="form-control" id="userPesel" name="userPesel"> <input type="email" class="form-control" id="email" name="email">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="title">Email</label> <label for="password">Password:</label>
<input type="text" class="form-control" id="userEmail" name="userEmail"> <input type="password" class="form-control" id="password" name="password">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="title">Numer telefonu</label> <label for="testowa">Wartosc Testowa:</label>
<input type="text" class="form-control" id="userPhone" name="userPhone"> <input type="text" class="form-control" id="testowa" name="testowa">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="title">Login</label> <button style="cursor:pointer" type="submit" class="btn btn-primary">Submit</button>
<input type="text" class="form-control" id="userLogin" name="userLogin">
</div> </div>
{{-- @include('partials.formerrors')--}}
<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> </form>
@stop @stop