protected function includeResourceFromModel(Model $model, string $identifier, $transformer = null): ResourceInterface
    {
        $data = $this->resolveRelation($model, $identifier);

        if (! $this->shouldCacheResource($data)) {
            return $this->resource($data, $transformer, $identifier);
        } elseif (key_exists($identifier, $this->resources)) {
            return $this->resources[$identifier]->setData($data);
        }

        return $this->resources[$identifier] = $this->resource($data, $transformer, $identifier);
    }