| Conditions | 2 |
| Paths | 2 |
| Total Lines | 40 |
| Code Lines | 27 |
| Lines | 8 |
| Ratio | 20 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | public function registerUser() { |
||
| 6 | $input = Input::only(array( |
||
|
|
|||
| 7 | 'firstName', |
||
| 8 | 'lastName', |
||
| 9 | 'email', |
||
| 10 | 'password', |
||
| 11 | 'role' |
||
| 12 | )); |
||
| 13 | |||
| 14 | |||
| 15 | $rules = array( |
||
| 16 | 'firstName' => 'required|min:4', |
||
| 17 | 'lastName' => 'required|min:4', |
||
| 18 | 'email' => 'required|email|unique:users', |
||
| 19 | 'password' => 'required|min:4', |
||
| 20 | 'role' => 'required' |
||
| 21 | ); |
||
| 22 | |||
| 23 | $validator = Validator::make($input, $rules); |
||
| 24 | $messages = $validator->messages(); |
||
| 25 | View Code Duplication | if($validator->fails()) { |
|
| 26 | |||
| 27 | return Response::json(array( |
||
| 28 | 'success' => false, |
||
| 29 | 'errors' => $validator->getMessageBag()->toArray(), |
||
| 30 | 400 |
||
| 31 | )); // 400 being the HTTP code for an invalid request. |
||
| 32 | } |
||
| 33 | |||
| 34 | $id = DB::table('users')->insertGetId( |
||
| 35 | ['first_name' => Input::get('firstName'),'last_name' => Input::get('lastName'),'email' => Input::get('email'), 'password' => Hash::make(Input::get('password'))] |
||
| 36 | ); |
||
| 37 | DB::table('user_roles')->insert( |
||
| 38 | ['user_id' => $id, 'role_id' => Input::get('role')] |
||
| 39 | ); |
||
| 40 | $channelId= Hash::make(Input::get('password')); |
||
| 41 | DB::table('channels')->insert( |
||
| 42 | ['channel_name' => $channelId, 'author_id' => $id] |
||
| 43 | ); |
||
| 44 | return View::make('templates/greeting')->with('message', "Account created successfully.You can now log in.Have a great day!"); |
||
| 45 | |||
| 52 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths