diff --git a/app/Http/Controllers/RegistrationController.php b/app/Http/Controllers/RegistrationController.php index a53fdcc..a94e6b3 100644 --- a/app/Http/Controllers/RegistrationController.php +++ b/app/Http/Controllers/RegistrationController.php @@ -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'); + } +} diff --git a/app/User.php b/app/User.php index f3d9c03..9d1fd77 100644 --- a/app/User.php +++ b/app/User.php @@ -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); + } } diff --git a/resources/views/register.blade.php b/resources/views/register.blade.php index e1b699f..6db4f11 100644 --- a/resources/views/register.blade.php +++ b/resources/views/register.blade.php @@ -5,58 +5,87 @@ @parent -
- Użytkownik +{{-- --}} +{{-- Użytkownik--}} +{{-- {{ csrf_field() }}--}} +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} + +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} + +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} + +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} + +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} + +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} + +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} + +{{-- @if ($errors->any())--}} +{{--
--}} +{{-- --}} +{{--
--}} +{{-- @endif--}} +{{-- --}} +{{--
--}} + +

Register

+
{{ csrf_field() }}
- - -
-
- - + +
- - + +
- - + +
- - + +
- - +
- -
- - -
- -
- - -
- - @if ($errors->any()) -
- -
- @endif - +{{-- @include('partials.formerrors')--}}
-@stop \ No newline at end of file +@stop