public function getComments() { $data = json_decode(urldecode(base64_decode(Input::get('data')))); $data = $data->data; //$data is a jason object with data as keyword $post = linkpreview::findOrFail($data->id); //$comments=array(); $comments = comments::where('linkId', '=', $post->id)->get(); //return collect($post->getComments()) ; //foreach($post->getComments() as $comment) // $comments[]=$comment; return $comments; }