app/Http/Resources/UserCommentResource.php
/**
     * Transform the resource into an array.
     *
     * @param Request $request
     * @return array
     */
Transform the resource into an array.
@param Request $request
@return array
Transform the resource into an array . @param Request $request @return array
public function toArray($request): array
    {
        $values = parent::toArray($request);
        $values['forumPost'] = [
            'title' => $this->content->title,
            'type' => $this->content->type,
            'url' => getForumLinkByTypeAndSlug($this->content->type, $this->content->slug)
        ];
        return $values;
    }
public function toArray ( $ request ) : array { $ values = parent :: toArray ( $ request ) ; $ values [ 'forumPost' ] = [ 'title' => $ this -> content -> title , 'type' => $ this -> content -> type , 'url' => getForumLinkByTypeAndSlug ( $ this -> content -> type , $ this -> content -> slug ) ] ; return $ values ; }
Transform the resource into an array.
Transform the resource into an array .