Total Complexity | 2 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 71.43% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | class SetTechTipComments |
||
18 | { |
||
19 | // Add a comment to a Tech Tip |
||
20 | 2 | public function createTipComment(TechTipNewCommentRequest $request) |
|
21 | { |
||
22 | 2 | TechTipComments::create([ |
|
23 | 2 | 'tip_id' => $request->tip_id, |
|
24 | 2 | 'user_id' => Auth::user()->user_id, |
|
25 | 2 | 'comment' => $request->comment, |
|
26 | ]); |
||
27 | |||
28 | // Notify the Tech Tip Owner |
||
29 | 2 | $ownerID = TechTips::find($request->tip_id)->user_id; |
|
30 | 2 | $owner = User::find($ownerID); |
|
31 | |||
32 | 2 | Notification::send($owner, new NewTechTipComment(Auth::user()->full_name, $request->tip_id)); |
|
33 | |||
34 | 2 | Log::info('User '.Auth::user()->full_name.' commented on Tech Tip ID '.$request->tip_id.'. Details - ', array($request)); |
|
35 | 2 | return true; |
|
36 | } |
||
37 | |||
38 | // Remove a comment from a Tech Tip |
||
39 | public function deleteTipComment($commentID) |
||
45 | } |
||
46 | } |
||
47 |