diff --git a/laravel/app/Http/Controllers/RegisterController.php b/laravel/app/Http/Controllers/RegisterController.php new file mode 100644 index 0000000..170d905 --- /dev/null +++ b/laravel/app/Http/Controllers/RegisterController.php @@ -0,0 +1,25 @@ +validate([ + 'name' => 'required|string|max:28|unique:users', + 'email' => 'required|string|email|unique:users', + 'password' => 'required|string|min:8|confirmed' + ]); + + $user = User::create($data); + + return redirect('/'); + } catch (ValidationException $e) { + return redirect()->back()->withInput($request->input())->withErrors($e->errors()); + } + } +} diff --git a/laravel/resources/views/default.blade.php b/laravel/resources/views/default.blade.php new file mode 100644 index 0000000..7b153b4 --- /dev/null +++ b/laravel/resources/views/default.blade.php @@ -0,0 +1,14 @@ + + + + + @yield('title') + + @yield('head') + + +
+ @yield('content') +
+ + \ No newline at end of file diff --git a/laravel/resources/views/register.blade.php b/laravel/resources/views/register.blade.php new file mode 100644 index 0000000..af05070 --- /dev/null +++ b/laravel/resources/views/register.blade.php @@ -0,0 +1,22 @@ +@extends('default') + +@section('title') + Register +@endsection + +@section('content') +

Register

+
+ @csrf + + + + + + + + + +
+
{{ $errors->first() }}
+@endsection \ No newline at end of file diff --git a/laravel/routes/web.php b/laravel/routes/web.php index 86a06c5..e461ea6 100644 --- a/laravel/routes/web.php +++ b/laravel/routes/web.php @@ -1,7 +1,13 @@