diff --git a/src/Http/Resources/AuthorResource.php b/src/Http/Resources/AuthorResource.php new file mode 100644 index 0000000..526d242 --- /dev/null +++ b/src/Http/Resources/AuthorResource.php @@ -0,0 +1,25 @@ + $this->id, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'image' => $this->avatar_url, + ]; + } +} diff --git a/src/Http/Resources/CategoryResource.php b/src/Http/Resources/CategoryResource.php new file mode 100644 index 0000000..1597cee --- /dev/null +++ b/src/Http/Resources/CategoryResource.php @@ -0,0 +1,25 @@ + $this->id, + 'name' => $this->name, + 'slug' => $this->slug, + 'url' => $this->url, + 'description' => $this->description, + ]; + } +} diff --git a/src/Http/Resources/ListPostResource.php b/src/Http/Resources/ListPostResource.php new file mode 100644 index 0000000..0dfd65b --- /dev/null +++ b/src/Http/Resources/ListPostResource.php @@ -0,0 +1,31 @@ + $this->id, + 'name' => $this->name, + 'slug' => $this->slug, + 'description' => $this->description, + 'image' => $this->image ? RvMedia::url($this->image) : null, + 'categories' => CategoryResource::collection($this->categories), + 'tags' => TagResource::collection($this->tags), + 'author' => AuthorResource::make($this->author), + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]; + } +}