where('studio_plus_video_id', $studioPlusVideo->id) ->when(!in_array(auth()->user()->role->type, ['superadmin', 'admin']), fn ($query) => $query->where('user_id', auth()->id())) ->latest() ->get(); // } /** * Store a newly created resource in storage. * @param Request $request * @return Response */ public function store(StudioPlusCommentRequest $request, StudioPlusVideo $studioPlusVideo) { $validated = $request->validated(); $validated['studio_plus_video_id'] = $studioPlusVideo->id; $validated['user_id'] = auth()->id(); // dd($validated); StudioPlusComment::create($validated); // } /** * Show the specified resource. * @param int $id * @return Response */ public function show($id) { // } /** * Update the specified resource in storage. * @param Request $request * @param int $id * @return Response */ public function update(StudioPlusCommentRequest $request, StudioPlusComment $comment) { $comment->update($request->validated()); // } /** * Remove the specified resource from storage. * @param int $id * @return Response */ public function destroy(StudioPlusComment $comment) { // // dd($validated); // StudioPlusComment::create($validated); $comment->delete(); return response()->noContent(); } }