Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 17 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
42 | public function sendSlackInvite(Request $request) |
||
43 | { |
||
44 | $validator= Validator::make($request->all(),[ |
||
45 | 'email'=>'required|email' |
||
46 | ]); |
||
47 | |||
48 | if ($validator->fails()) |
||
49 | { |
||
50 | return redirect()->back()->with('error','Sorry! Please enter a valid mail or you have used this mail here'); |
||
51 | }else{ |
||
52 | $email = $request->input('email'); |
||
53 | $this->client->request('POST', |
||
54 | config('LaravelSlack.slack_team_url').'/api/users.admin.invite?t='.time().'&email='.$email.'&token='.config('LaravelSlack.slack_api_token').'&set_active=true&_attempts=1' |
||
55 | ); |
||
56 | return redirect()->back()->with('alert','Congratulation! Your Invite has been sent successfully to your mail'); |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.