Passed
Push — dev5 ( 1d5fd3...2b65af )
by Ron
08:51
created

CustomerNotesController::store()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

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 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Http\Controllers\Customers;
4
5
use App\Http\Controllers\Controller;
6
7
use App\Domains\Customers\GetCustomerNotes;
8
use App\Domains\Customers\SetCustomerNotes;
9
10
use App\Http\Requests\CustomerNewNoteRequest;
11
use App\Http\Requests\CustomerEditNoteRequest;
12
13
class CustomerNotesController extends Controller
14
{
15
16 26
    public function __construct()
17
    {
18 26
        $this->middleware('auth');
19 26
    }
20
21
    //  Store a new customer note
22 4
    public function store(CustomerNewNoteRequest $request)
23
    {
24 4
        (new SetCustomerNotes($request->cust_id))->createNote($request);
25 4
        return response()->json(['success' => true]);
26
    }
27
28
    //  Get the customer notes
29 4
    public function show($id)
30
    {
31 4
        return (new GetCustomerNotes($id))->execute();
32
    }
33
34
    //  Update a customer note
35 4
    public function update(CustomerEditNoteRequest $request, $id)
36
    {
37 4
        (new SetCustomerNotes($request->cust_id))->updateNote($request, $id);
38 4
        return response()->json(['success' => true]);
39
    }
40
41
    //  Delete a customer note
42 2
    public function destroy($id)
43
    {
44 2
        (new SetCustomerNotes($id))->deleteNote($id);
45 2
        return response()->json(['success' => true]);
46
    }
47
}
48