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

TechTipCommentsController::destroy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
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