/** * Display a listing of the resource. * * @return Response */ public function index($product) { $comments = Comment::where('product_id', '=', $product)->get(); $comments = Comment::add_created_by_editable($comments); return response()->json(['comments' => $comments]); }