public function serialize(Lesson $lesson, array $options = [])
    {
        $firstChapter = $this->chapterRepository->getFirstChapter($lesson);

        $serialized = [
            'id' => $lesson->getUuid(),
            'title' => $lesson->getResourceNode()->getName(),
            'firstChapterId' => $firstChapter ? $firstChapter->getUuid() : null,
            'firstChapterSlug' => $firstChapter ? $firstChapter->getSlug() : null,
        ];

        return $serialized;
    }
public function serialize(Lesson $lesson, array $options = [])
    {
        $firstChapter = $this->chapterRepository->getFirstChapter($lesson);

        $serialized = [
            'id' => $lesson->getUuid(),
            'title' => $lesson->getResourceNode()->getName(),
            'firstChapterId' => $firstChapter ? $firstChapter->getUuid() : null,
            'firstChapterSlug' => $firstChapter ? $firstChapter->getSlug() : null,
        ];

        return $serialized;
    }
public function serialize ( Lesson $ lesson , array $ options = [ ] ) { $ firstChapter = $ this -> chapterRepository -> getFirstChapter ( $ lesson ) ; $ serialized = [ 'id' => $ lesson -> getUuid ( ) , 'title' => $ lesson -> getResourceNode ( ) -> getName ( ) , 'firstChapterId' => $ firstChapter ? $ firstChapter -> getUuid ( ) : null , 'firstChapterSlug' => $ firstChapter ? $ firstChapter -> getSlug ( ) : null , ] ; return $ serialized ; }
Serializes a Lesson entity for the JSON api.

@param Lesson $lesson  - the Lesson resource to serialize
@param array  $options - a list of serialization options

@return array - the serialized representation of the Lesson resource
Serializes a Lesson entity for the JSON api .