Passed
Push — dev5 ( cbc2fc...7d6fd9 )
by Ron
09:10
created

TechTipCommentsController   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 72.72%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 25
ccs 8
cts 11
cp 0.7272
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 3 1
A destroy() 0 4 1
A __construct() 0 3 1
A store() 0 4 1
1
<?php
2
3
namespace App\Http\Controllers\TechTips;
4
5
use App\Http\Controllers\Controller;
6
7
use App\Domains\TechTips\GetTechTipComments;
8
use App\Domains\TechTips\SetTechTipComments;
9
10
use App\Http\Requests\TechTipNewCommentRequest;
11
12
class TechTipCommentsController extends Controller
13
{
14 8
    public function __construct()
15
    {
16 8
        $this->middleware('auth');
17 8
    }
18
19
    //  Add a new Tech Tip Comment
20 2
    public function store(TechTipNewCommentRequest $request)
21
    {
22 2
        (new SetTechTipComments)->createTipComment($request);
23 2
        return response()->json(['success' => true]);
24
    }
25
26
    //  Retrieve the comments for a tech tip
27 2
    public function show($id)
28
    {
29 2
        return (new GetTechTipComments)->execute($id);
30
    }
31
32
    //  Delete a comment
33
    public function destroy($id)
34
    {
35
        (new SetTechTipComments)->deleteTipComment($id);
36
        return response()->json(['success' => true]);
37
    }
38
}
39