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 @@ + + +
+ +{{ $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 @@