app/Http/Resources/TravelmateResource.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
    {
        return [
            'id' => $this->id,
            'title' => $this->title,
            'slug' => $this->slug,
            'createdAt' => formatDate($this->created_at),
            'user' => new UserResource($this->user),
            'destinations' => DestinationResource::collection($this->destinations),
            'topics' => TopicResource::collection($this->topics),
        ];
    }
public function toArray ( $ request ) : array { return [ 'id' => $ this -> id , 'title' => $ this -> title , 'slug' => $ this -> slug , 'createdAt' => formatDate ( $ this -> created_at ) , 'user' => new UserResource ( $ this -> user ) , 'destinations' => DestinationResource :: collection ( $ this -> destinations ) , 'topics' => TopicResource :: collection ( $ this -> topics ) , ] ; }
Transform the resource into an array.
Transform the resource into an array .