|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\Customers; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
6
|
|
|
use App\Http\Requests\Customers\CustomerNoteRequest; |
|
7
|
|
|
use App\Models\CustomerNote; |
|
8
|
|
|
|
|
9
|
|
|
class CustomerNoteController extends Controller |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* Store a new customer note |
|
13
|
|
|
*/ |
|
14
|
|
|
public function store(CustomerNoteRequest $request) |
|
15
|
|
|
{ |
|
16
|
|
|
CustomerNote::create([ |
|
17
|
|
|
'cust_id' => $request->cust_id, |
|
18
|
|
|
'created_by' => $request->user()->user_id, |
|
19
|
|
|
'urgent' => $request->urgent, |
|
20
|
|
|
'shared' => $request->shared, |
|
21
|
|
|
'subject' => $request->subject, |
|
22
|
|
|
'details' => $request->details, |
|
23
|
|
|
]); |
|
24
|
|
|
|
|
25
|
|
|
return response()->noContent(); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Get all of the notes for a customer |
|
30
|
|
|
*/ |
|
31
|
|
|
public function show($id) |
|
32
|
|
|
{ |
|
33
|
|
|
return CustomerNote::where('cust_id', $id)->get(); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Modify an existing note |
|
38
|
|
|
*/ |
|
39
|
|
|
public function update(CustomerNoteRequest $request, $id) |
|
40
|
|
|
{ |
|
41
|
|
|
CustomerNote::find($id)->update([ |
|
42
|
|
|
'updated_by' => $request->user()->user_id, |
|
43
|
|
|
'urgent' => $request->urgent, |
|
44
|
|
|
'shared' => $request->shared, |
|
45
|
|
|
'subject' => $request->subject, |
|
46
|
|
|
'details' => $request->details, |
|
47
|
|
|
]); |
|
48
|
|
|
|
|
49
|
|
|
return response()->noContent(); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Delete a customer Note |
|
54
|
|
|
*/ |
|
55
|
|
|
public function destroy($id) |
|
56
|
|
|
{ |
|
57
|
|
|
CustomerNote::find($id)->delete(); |
|
58
|
|
|
|
|
59
|
|
|
return response()->noContent(); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|