| Total Complexity | 4 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 76.47% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class TechTipCommentsController extends Controller |
||
| 12 | { |
||
| 13 | 8 | public function __construct() |
|
| 14 | { |
||
| 15 | 8 | $this->middleware('auth'); |
|
| 16 | 8 | } |
|
| 17 | |||
| 18 | // Add a new Tech Tip Comment |
||
| 19 | 2 | public function store(Request $request) |
|
| 20 | { |
||
| 21 | 2 | $request->validate([ |
|
| 22 | 2 | 'comment' => 'required', |
|
| 23 | 'tipID' => 'required', |
||
| 24 | ]); |
||
| 25 | |||
| 26 | 2 | TechTipComments::create([ |
|
| 27 | 2 | 'tip_id' => $request->tipID, |
|
| 28 | 2 | 'user_id' => Auth::user()->user_id, |
|
| 29 | 2 | 'comment' => $request->comment |
|
| 30 | ]); |
||
| 31 | |||
| 32 | 2 | return response()->json(['success' => true]); |
|
| 33 | } |
||
| 34 | |||
| 35 | // Retrieve the comments for a tech tip |
||
| 36 | 2 | public function show($id) |
|
| 39 | } |
||
| 40 | |||
| 41 | // Delete a comment |
||
| 42 | public function destroy($id) |
||
| 48 | } |
||
| 49 | } |
||
| 50 |