diff options
author | Camil Staps | 2016-09-25 23:56:46 +0200 |
---|---|---|
committer | Camil Staps | 2016-09-26 01:02:05 +0200 |
commit | 33ad0c14d168d36a4e7ad42dc6aa6a37a7335849 (patch) | |
tree | 0543b7d92f7f0b7706f4313ba10b18483f747798 /app/Http/Controllers/UserController.php | |
parent | Added unique visitors to statistics (diff) |
Change from lumen 5.2 to laravel 5.3 (Resolves #1)
Diffstat (limited to 'app/Http/Controllers/UserController.php')
-rw-r--r-- | app/Http/Controllers/UserController.php | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php deleted file mode 100644 index 7036439..0000000 --- a/app/Http/Controllers/UserController.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * HebrewParseTrainer - practice Hebrew verbs - * Copyright (C) 2015 Camil Staps <info@camilstaps.nl> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -namespace App\Http\Controllers; - -use Illuminate\Http\Request; -use Illuminate\Support\Facades\Validator; -use Illuminate\Validation\ValidationException; -use Laravel\Lumen\Routing\Controller as BaseController; - -use HebrewParseTrainer\User; - -class UserController extends BaseController { - - public function createForm(Request $request) { - $messages = []; - - if ($request->isMethod('post')) { - $validator = Validator::make($request->input(), [ - 'email' => 'required|unique:users|email', - 'name' => 'required|unique:users', - 'password' => 'required|confirmed|min:8', - ]); - - if ($validator->fails()) { - foreach ($validator->errors()->all() as $error) { - $messages[] = ['danger', $error]; - } - } else { - $user = new User; - $user->name = $request->input('name'); - $user->email = $request->input('email'); - $user->password = $request->input('password'); - if ($user->save()) { - $messages[] = ['success', 'Your account has been created.']; - } else { - $messages[] = ['danger', 'Your account could not be created.']; - } - } - } - - return view('user.create', - [ - 'messages' => $messages, - 'form' => [ - 'email' => $request->input('email'), - 'name' => $request->input('name') - ] - ]); - } - -} |